Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Windows
Desktop
one year ago
Benchmark.js
typeof -> boolean
16.6M/s
typeof -> function
16.6M/s
typeof -> string
16.3M/s
typeof -> object
16.3M/s
Object.prototype.toString.call -> function
6.5M/s
Object.prototype.toString.call -> string
6.5M/s
Object.prototype.toString.call -> boolean
6.5M/s
Object.prototype.toString.call -> object
6.4M/s
View exact numbers
Test name Executions per second
typeof -> boolean 16,611,017 Ops/sec
typeof -> function 16,607,866 Ops/sec
typeof -> string 16,324,903 Ops/sec
typeof -> object 16,252,367 Ops/sec
Object.prototype.toString.call -> function 6,519,179 Ops/sec
Object.prototype.toString.call -> string 6,476,530 Ops/sec
Object.prototype.toString.call -> boolean 6,472,016 Ops/sec
Object.prototype.toString.call -> object 6,446,493 Ops/sec
Script Preparation code:
Tests: