Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Windows
Desktop
2 years ago
Test name Executions per second
typeof -> string 2187198.8 Ops/sec
Object.prototype.toString.call -> string 797323.1 Ops/sec
typeof -> boolean 2326318.8 Ops/sec
Object.prototype.toString.call -> boolean 794767.6 Ops/sec
typeof -> object 2203048.0 Ops/sec
Object.prototype.toString.call -> object 800838.0 Ops/sec
typeof -> function 2206809.0 Ops/sec
Object.prototype.toString.call -> function 776964.2 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