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

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

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

     
    array.length = 0;
  • array = [];

     
    array = [];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    while (array.length > 0) { array.pop(); }
    while (array.pop()) {}
    array.length = 0;
    array = [];

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2025 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Firefox 57 on Windows
View result in a separate tab
Test name Executions per second
while (array.length > 0) { array.pop(); } 228277648.0 Ops/sec
while (array.pop()) {} 19190388.0 Ops/sec
array.length = 0; 35105048.0 Ops/sec
array = []; 74265104.0 Ops/sec