Script Preparation code:
AخA
 
   var arr = [];
    for (var i = 0; i < 10000; i++) {
      arr[i] = i;
    }
  
Tests:
  • foreach

     
    arr.forEach(function (item){
      item * 3 * 8
    })
  • for

     
    for (let i = 0; i < arr.lenght; i++) {
      arr[i] * 3 * 8
    }
  • map

     
    arr.map(item => item * 3 * 8)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    foreach
    for
    map

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36
Chrome 99 on Linux
View result in a separate tab
Test name Executions per second
foreach 4831.7 Ops/sec
for 7319764.5 Ops/sec
map 4586.8 Ops/sec