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
Benchmark.js
typeof -> function
4.9M/s
typeof -> boolean
4.8M/s
typeof -> object
4.8M/s
typeof -> string
4.5M/s
Object.prototype.toString.call -> function
2.3M/s
Object.prototype.toString.call -> boolean
2.3M/s
Object.prototype.toString.call -> object
2.2M/s
Object.prototype.toString.call -> string
2.2M/s
View exact numbers
Test name Executions per second
typeof -> function 4,857,546 Ops/sec
typeof -> boolean 4,770,446 Ops/sec
typeof -> object 4,764,828 Ops/sec
typeof -> string 4,465,724 Ops/sec
Object.prototype.toString.call -> function 2,273,474 Ops/sec
Object.prototype.toString.call -> boolean 2,260,518 Ops/sec
Object.prototype.toString.call -> object 2,220,998 Ops/sec
Object.prototype.toString.call -> string 2,187,106 Ops/sec
Script Preparation code:
Tests: