Script Preparation code:
Tests:

Historical Performance Data aggregated from 8 community runs

Desktop Results:
Chrome 8 runs
typeof -> boolean
2.2M/s
typeof -> string
2.1M/s
typeof -> function
2.1M/s
typeof -> object
2.1M/s
Object.prototype.toString.call -> object
774K/s
Object.prototype.toString.call -> string
773K/s
Object.prototype.toString.call -> boolean
772K/s
Object.prototype.toString.call -> function
761K/s

Fastest: typeof -> boolean (2.9x faster)

View exact numbers
  • typeof -> boolean: 2,217,571 ops/sec
  • typeof -> string: 2,145,464 ops/sec
  • typeof -> function: 2,131,187 ops/sec
  • typeof -> object: 2,127,069 ops/sec
  • Object.prototype.toString.call -> object: 774,166 ops/sec
  • Object.prototype.toString.call -> string: 772,825 ops/sec
  • Object.prototype.toString.call -> boolean: 772,244 ops/sec
  • Object.prototype.toString.call -> function: 761,454 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    typeof -> string
    Object.prototype.toString.call -> string
    typeof -> boolean
    Object.prototype.toString.call -> boolean
    typeof -> object
    Object.prototype.toString.call -> object
    typeof -> function
    Object.prototype.toString.call -> function

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Firefox 141 on Windows
View result in a separate tab
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