Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Firefox 115
Linux
Desktop
2 years ago
Benchmark.js
typeof -> string
11.2M/s
typeof -> function
9.3M/s
typeof -> boolean
7.0M/s
typeof -> object
6.6M/s
Object.prototype.toString.call -> function
1.5M/s
Object.prototype.toString.call -> boolean
1.3M/s
Object.prototype.toString.call -> object
1.3M/s
Object.prototype.toString.call -> string
1.3M/s
View exact numbers
Test name Executions per second
typeof -> string 11,241,123 Ops/sec
typeof -> function 9,316,022 Ops/sec
typeof -> boolean 6,973,045 Ops/sec
typeof -> object 6,621,990 Ops/sec
Object.prototype.toString.call -> function 1,454,491 Ops/sec
Object.prototype.toString.call -> boolean 1,302,055 Ops/sec
Object.prototype.toString.call -> object 1,284,446 Ops/sec
Object.prototype.toString.call -> string 1,268,119 Ops/sec
Script Preparation code:
Tests: