Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0
Firefox 131
Mac OS X 10.15
Desktop
one year ago
Benchmark.js
typeof -> string
15.8M/s
typeof -> function
14.0M/s
typeof -> boolean
11.2M/s
typeof -> object
10.3M/s
Object.prototype.toString.call -> function
3.2M/s
Object.prototype.toString.call -> string
2.9M/s
Object.prototype.toString.call -> boolean
2.9M/s
Object.prototype.toString.call -> object
2.9M/s
View exact numbers
Test name Executions per second
typeof -> string 15,782,823 Ops/sec
typeof -> function 13,957,343 Ops/sec
typeof -> boolean 11,151,455 Ops/sec
typeof -> object 10,339,821 Ops/sec
Object.prototype.toString.call -> function 3,182,986 Ops/sec
Object.prototype.toString.call -> string 2,924,286 Ops/sec
Object.prototype.toString.call -> boolean 2,923,550 Ops/sec
Object.prototype.toString.call -> object 2,891,378 Ops/sec
Script Preparation code:
Tests: