Script Preparation code:
AخA
 
var myArraySmall = Array(3);
for (let i=0; i<3; i++) {
    myArraySmall[i] = i; 
}
Tests:
  • for element of SMALL

     
    for (ele of myArraySmall) {
      let something = ele;
    }
  • for const element of SMALL

     
    for (const ele of myArraySmall) {
        let something = ele;
    }
  • myArr forEach SMALL

     
    myArraySmall.forEach(function(s) {
        let something = s;
    });
  • array index SMALL

     
    for (let i=0; i<3; i++) {
      let something = myArraySmall[i];
    }
  • map

     
    myArraySmall.map((i) => {
      let something = i;
    });
  • forEach ES6 SMALL

     
    myArraySmall.forEach(s => {
        let something = s;
    });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    for element of SMALL
    for const element of SMALL
    myArr forEach SMALL
    array index SMALL
    map
    forEach ES6 SMALL

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
Firefox 66 on Windows 7
View result in a separate tab
Test name Executions per second
for element of SMALL 7568435.5 Ops/sec
for const element of SMALL 15427500.0 Ops/sec
myArr forEach SMALL 50719700.0 Ops/sec
array index SMALL 35450744.0 Ops/sec
map 18077240.0 Ops/sec
forEach ES6 SMALL 52956176.0 Ops/sec