Script Preparation code:
AخA
 
var size = 10000;
var arr = [];
for (var i = 0; i < size; i++){
  arr.push(i);
}
Tests:
  • Set length to zero

     
    arr.length = 0;
  • Splice

     
    arr.splice(0, arr.length);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Set length to zero
    Splice

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Firefox 113 on Windows
View result in a separate tab
Test name Executions per second
Set length to zero 68086160.0 Ops/sec
Splice 41853332.0 Ops/sec