Script Preparation code:
x
 
const item_1 = Math.floor(Math.random() * 1);
const array_1 = new Array(1).map((_, i) => i);
const set_1 = new Set(array_1);
const item_2 = Math.floor(Math.random() * 2);
const array_2 = new Array(2).map((_, i) => i);
const set_2 = new Set(array_2);
const item_4 = Math.floor(Math.random() * 4);
const array_4 = new Array(4).map((_, i) => i);
const set_4 = new Set(array_4);
const item_8 = Math.floor(Math.random() * 8);
const array_8 = new Array(8).map((_, i) => i);
const set_8 = new Set(array_8);
Tests:
  • array_1

     
    array_1.includes(item_1)
  • set_1

     
    set_1.has(item_1)
  • array_2

     
    array_2.includes(item_2)
  • set_2

     
    set_2.has(item_2)
  • array_4

     
    array_4.includes(item_4)
  • set_4

     
    set_4.has(item_4)
  • array_8

     
    array_8.includes(item_8)
  • set_8

     
    set_8.has(item_8)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array_1
    set_1
    array_2
    set_2
    array_4
    set_4
    array_8
    set_8

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Chrome 132 on Windows
View result in a separate tab
Test name Executions per second
array_1 49544920.0 Ops/sec
set_1 58616264.0 Ops/sec
array_2 44347332.0 Ops/sec
set_2 58414468.0 Ops/sec
array_4 44401620.0 Ops/sec
set_4 59612848.0 Ops/sec
array_8 38383360.0 Ops/sec
set_8 59723020.0 Ops/sec