Script Preparation code:
x
 
var types = {
    array: [1, 2, 3],
    number: 123,
    string: '123',
    map: new Map([
        [1, 1],
        [2, 2],
        [3, 3]
    ]),
    set: new Set([1, 2, 3]),
    buffer: new ArrayBuffer([1, 2, 3]),
    boolean: true,
    arrow: () => {},
    function: function() {},
    object: {}
}
var keys = Object.keys(types)
Tests:
  • typeof -> object

     
    keys.map(key => typeof types[key] === "object")
  • Object.prototype.toString.call -> object

     
    keys.map(key => Object.prototype.toString.call(types[key]) === '[object Object]')
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    typeof -> object
    Object.prototype.toString.call -> object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Chrome 107 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
typeof -> object 1969445.9 Ops/sec
Object.prototype.toString.call -> object 679313.1 Ops/sec