Script Preparation code:
x
 
var count = 10000;
var target = [];
for(let i = 0; i < count; i++) {
  target[i] = i;
}
Tests:
  • while roop

     
    var sum = 0;
    var i = 0;
    while(sum < 70000) {
      sum += target[i];
      i++;
    }
  • for

     
    var sum = 0;
    for(let i = 0; sum < 70000; i++) {
      sum += target[i];
    }
  • call myself

     
    var sum = 0;
    var i = 0;
    var sumFunction = (num) => {
      sum += target[num];
      i++;
      if(sum < 70000) sumFunction(i);
    };
    sumFunction(i);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    while roop
    for
    call myself

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
while roop 91320.3 Ops/sec
for 91455.2 Ops/sec
call myself 61779.1 Ops/sec