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: {},
  u8: new Uint8Array(),
  u16: new Uint16Array(),
  u32: new Uint32Array(),
  i8: new Int8Array(),
  i16: new Int16Array(),
  i32: new Int32Array()
}
Tests:
  • instanceof

     
    const t1 = types.array instanceof Array
    const t2 = types.object instanceof Array
  • isArray

     
    const t1 = Array.isArray(types.array)
    const t2 = Array.isArray(types.object)
  • Symbol.iterator

     
    const t1 = types.array[Symbol.iterator] !== undefined
    const t2 = types.object[Symbol.iterator] !== undefined
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    instanceof
    isArray
    Symbol.iterator

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:71.0) Gecko/20100101 Firefox/71.0
Firefox 71 on Mac OS X 10.15
View result in a separate tab
Test name Executions per second
instanceof 78289448.0 Ops/sec
isArray 77950024.0 Ops/sec
Symbol.iterator 53720636.0 Ops/sec