Tests:
  • array

    x
     
    const arr = new Array(10000).fill(Math.floor(Math.random() * 1000));
    const s = new Set(arr);
    for (let i = 0; i < arr.length; i++) {
      const idx = arr.indexOf(i);
      if (i !== -1) {
        arr.splice(idx, 1);
      }
    }
  • set

     
    const arr = new Array(10000).fill(Math.floor(Math.random() * 1000));
    const s = new Set(arr);
    for (let i = 0; i < arr.length; i++) {
      if (s.has(i)) {
        s.delete(i);
      }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array
    set

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.0.0 Safari/537.36 Edg/75.0.131.0
Chrome 88 on Windows
View result in a separate tab
Test name Executions per second
array 25.3 Ops/sec
set 6684.9 Ops/sec