Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135
Windows
Desktop
one year ago
Test name Executions per second
typeof -> string 4465723.5 Ops/sec
Object.prototype.toString.call -> string 2187106.0 Ops/sec
typeof -> boolean 4770446.5 Ops/sec
Object.prototype.toString.call -> boolean 2260518.5 Ops/sec
typeof -> object 4764828.0 Ops/sec
Object.prototype.toString.call -> object 2220997.5 Ops/sec
typeof -> function 4857545.5 Ops/sec
Object.prototype.toString.call -> function 2273474.5 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