Script Preparation code:
AخA
 
var arr = [];
for(let i = 0; i < 10000; i++) {
  arr.push(Math.random());
}
var arrLength = arr.length;
var sum = 0;
Tests:
  • Iterator for loop

     
    for(const num of arr) {
      sum += num;
    }
  • Index for loop

     
    for(let i = 0; i < arrLength; i++) {
      sum += arr[i];
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Iterator for loop
    Index for loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110 on Linux
View result in a separate tab
Test name Executions per second
Iterator for loop 5218.8 Ops/sec
Index for loop 6839.0 Ops/sec