Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Firefox 115
Linux
Desktop
2 years ago
Test name Executions per second
typeof -> string 11241123.0 Ops/sec
Object.prototype.toString.call -> string 1268119.2 Ops/sec
typeof -> boolean 6973045.0 Ops/sec
Object.prototype.toString.call -> boolean 1302054.6 Ops/sec
typeof -> object 6621990.0 Ops/sec
Object.prototype.toString.call -> object 1284445.6 Ops/sec
typeof -> function 9316022.0 Ops/sec
Object.prototype.toString.call -> function 1454491.1 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