Script Preparation code:
x
 
var array = [];
for(var i = 0; i < 100000; i++){array.push(Math.random());}
Tests:
  • pop

     
    while (array.length > 0)
    {
      array.pop();
    }
  • shift

     
    while (array.length > 0)
    {
      array.shift();
    }
  • length

     
    array.length = 0
  • reassignment

     
    array = []
  • .splice(0)

     
    array.splice(0);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    pop
    shift
    length
    reassignment
    .splice(0)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Linux
View result in a separate tab
Test name Executions per second
pop 93580616.0 Ops/sec
shift 92874864.0 Ops/sec
length 25220498.0 Ops/sec
reassignment 8925873.0 Ops/sec
.splice(0) 36727884.0 Ops/sec