Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
typeof -> string 2681463.0 Ops/sec
Object.prototype.toString.call -> string 971714.5 Ops/sec
typeof -> boolean 2651484.8 Ops/sec
Object.prototype.toString.call -> boolean 979864.6 Ops/sec
typeof -> object 2423793.8 Ops/sec
Object.prototype.toString.call -> object 962969.7 Ops/sec
typeof -> function 2427701.0 Ops/sec
Object.prototype.toString.call -> function 932572.8 Ops/sec
Script Preparation code:
Tests:
  • typeof -> string

  • Object.prototype.toString.call -> string

  • typeof -> boolean

  • Object.prototype.toString.call -> boolean

  • typeof -> object

  • Object.prototype.toString.call -> object

  • typeof -> function

  • Object.prototype.toString.call -> function