Script Preparation code:
AخA
 
var arr = new Array(15000);
arr.fill({ id: 0 });
arr = arr.map((el, idx) => el.id = idx);
var idToFilter = Math.floor(Math.random() * 15000);
Tests:
  • indexOf + splice

     
    var index = arr.indexOf(idToFilter);
    var newArray = [...arr].splice(index, 1);
  • filter

     
    var newArray = arr.filter(e => e.id !== idToFilter);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    indexOf + splice
    filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
indexOf + splice 362006.1 Ops/sec
filter 19969.9 Ops/sec