Script Preparation code:
x
 
function noop() {}
var array = [];
(function () {
  var length = 100;
  while (length--) {
    array.push(Math.random());
  }
})();
Tests:
  • for

     
            var i = 0;
    var length = array.length;
    for (; i < length; i++) {
      noop(array[i]);
    }
  • reverse while

     
    var i = array.length;
    while (i--) {
      noop(array[i]);
    }
  • caching while

     
    var i = 0;
    var item;
    while (item = array[i++]) {
      noop(item);
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    for
    reverse while
    caching while

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0
Firefox 117 on Linux
View result in a separate tab
Test name Executions per second
for 7771494.0 Ops/sec
reverse while 5702706.5 Ops/sec
caching while 3871925.8 Ops/sec