Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
typeof -> string
2.7M/s
typeof -> boolean
2.7M/s
typeof -> function
2.4M/s
typeof -> object
2.4M/s
Object.prototype.toString.call -> boolean
980K/s
Object.prototype.toString.call -> string
972K/s
Object.prototype.toString.call -> object
963K/s
Object.prototype.toString.call -> function
933K/s
View exact numbers
Test name Executions per second
typeof -> string 2,681,463 Ops/sec
typeof -> boolean 2,651,485 Ops/sec
typeof -> function 2,427,701 Ops/sec
typeof -> object 2,423,794 Ops/sec
Object.prototype.toString.call -> boolean 979,865 Ops/sec
Object.prototype.toString.call -> string 971,714 Ops/sec
Object.prototype.toString.call -> object 962,970 Ops/sec
Object.prototype.toString.call -> function 932,573 Ops/sec
Script Preparation code:
Tests: