Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Firefox 141
Windows
Desktop
one year ago
Benchmark.js
typeof -> string
27.6M/s
typeof -> function
24.2M/s
typeof -> boolean
15.0M/s
typeof -> object
12.8M/s
Object.prototype.toString.call -> function
4.5M/s
Object.prototype.toString.call -> boolean
4.1M/s
Object.prototype.toString.call -> object
4.0M/s
Object.prototype.toString.call -> string
4.0M/s
View exact numbers
Test name Executions per second
typeof -> string 27,567,416 Ops/sec
typeof -> function 24,192,610 Ops/sec
typeof -> boolean 15,027,905 Ops/sec
typeof -> object 12,846,283 Ops/sec
Object.prototype.toString.call -> function 4,457,707 Ops/sec
Object.prototype.toString.call -> boolean 4,075,636 Ops/sec
Object.prototype.toString.call -> object 3,999,299 Ops/sec
Object.prototype.toString.call -> string 3,991,418 Ops/sec
Script Preparation code:
Tests: