Script Preparation code:
AخA
 
var arr =new Array(1000000);
Tests:
  • while

     
    let i=0;
    while(i < arr.length) {
      const exp = arr[i] ** 2;
      i++;
    }
  • for

     
    for(let i=0; i<arr.length; i++) {
      const exp = arr[i] ** 2;
    }
  • forEach

     
    arr.forEach((element) => {
      const exp = element ** 2;
    });
  • for of

     
    for(const element of arr) {
      const exp = element ** 2;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    while
    for
    forEach
    for of

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Chrome 105 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
while 5.9 Ops/sec
for 6.4 Ops/sec
forEach 231.8 Ops/sec
for of 54.2 Ops/sec