Script Preparation code:
AخA
 
const array = Array.from({length: 10_000}, () => Math.floor(Math.random() * 10_000_000));
const indexToDelete = 7500;
const deleteCount = 500;
Tests:
  • Array.filter

     
    const temp = [...array];
    return temp.filter((x, i) => i < indexToDelete || i >= indexToDelete + deleteCount);
  • Array.splice

     
    const temp = [...array];
    temp.splice(indexToDelete, deleteCount);
    return temp;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array.filter
    Array.splice

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 10 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Array.filter 30207.4 Ops/sec
Array.splice 500059.7 Ops/sec