Tests:
  • Splice

    x
     
    const a = ["a", "b", "c", "d", "e"];
    const indexToRemove = 2;
    const b = a.splice(indexToRemove, 1); 
  • Slice using spread uperator

     
    const a = ["a", "b", "c", "d", "e"];
    const indexToRemove = 2;
    const b = [...a.slice(0, indexToRemove), ...a.slice(indexToRemove + 1)]; 
  • Slice using concat

     
    const a = ["a", "b", "c", "d", "e"];
    const indexToRemove = 2;
    const b = a.slice(0, indexToRemove).concat(a.slice(indexToRemove + 1)); 
  • Filter

     
    const a = ["a", "b", "c", "d", "e"];
    const indexToRemove = 2;
    const b = a.filter((_, i) => i !== indexToRemove)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Splice
    Slice using spread uperator
    Slice using concat
    Filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 days ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Chrome 136 on Linux
View result in a separate tab
Test name Executions per second
Splice 32619656.0 Ops/sec
Slice using spread uperator 19466134.0 Ops/sec
Slice using concat 10752598.0 Ops/sec
Filter 55883940.0 Ops/sec