Script Preparation code:
AخA
 
var arr = new Array(1000000).fill(0)
Tests:
  • Map

     
    arr.map(n => {});
  • forLoop

     
    const length = arr.length;  
    for (let i = 0; i < length; i++) {}
  • forEach

     
    arr.forEach(n => {});
  • forOf

     
    for (const num of arr) {}
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Map
    forLoop
    forEach
    forOf

    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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119 on Windows
View result in a separate tab
Test name Executions per second
Map 109.7 Ops/sec
forLoop 4482.2 Ops/sec
forEach 584.7 Ops/sec
forOf 303.1 Ops/sec