Script Preparation code:
AخA
 
var arr =new Array(10000);
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: 6 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126 on Linux
View result in a separate tab
Test name Executions per second
while 969.7 Ops/sec
for 892.2 Ops/sec
forEach 84817.3 Ops/sec
for of 338432.1 Ops/sec