Script Preparation code:
AخA
 
var len = 100000;
var arr = Array(len).fill(42);
var deleteIndexes = Array.from(Array(1000), () => (Math.random() * len)|0);
console.log("deleteIndexes", deleteIndexes);
Tests:
  • splice

    x
     
    for (const i of deleteIndexes) {
      arr.splice(i, 1); 
    }
  • delete + Object.values

     
    for (const i of deleteIndexes) {
      delete arr[i]; 
    }
    let res = Object.values(arr);
  • filter

     
    arr.filter((val, idx) => deleteIndexes.includes(idx))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    splice
    delete + Object.values
    filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Chrome 110 on Windows
View result in a separate tab
Test name Executions per second
splice 1187.0 Ops/sec
delete + Object.values 2529.7 Ops/sec
filter 41532.3 Ops/sec