Script Preparation code:
AخA
 
var obj = (new Array(1000)).fill(null).reduce((prev, newVal) => {prev[Math.random() + ''] = Math.random() + ''; return prev; }, { sausage: 'tst' });
var array = Object.keys(obj);
var set = new Set(array);
Tests:
  • Includes

     
    array.includes('sausage')
  • Object[key]

     
    obj['sausage']
  • Set.has(key)

     
    set.has('sausage')
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Includes
    Object[key]
    Set.has(key)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 9 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Windows
View result in a separate tab
Test name Executions per second
Includes 15497112.0 Ops/sec
Object[key] 14744717.0 Ops/sec
Set.has(key) 15518599.0 Ops/sec