Tests:
  • splice

    AخA
     
    var index = 2;
    var array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    var output = [
      ...array.slice(0, index),
      10,
      ...array.slice(index + 1)
    ];
  • Object.assign

     
    var array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    var output = Object.assign([], array, {2: 10});
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    splice
    Object.assign

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36
Chrome Mobile 131 on Android
View result in a separate tab
Test name Executions per second
splice 7920754.0 Ops/sec
Object.assign 459369.7 Ops/sec