reverse loop (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  var count = 5000;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
for loop - standard
var a;
for (var i = 0; i < count; i++) {
    // loop
    a = i;
}
ready
for loop - reverse
var a;
for (var i = count-1; i >= 0; i--) {
    // loop
    a = i;
}
ready
while loop - normal
var i = 0;
var a;
while (i < count) {
    // loop
    a = i;
    i++;
}
ready
while loop - reverse
var i = count;
var a;
while (i--) {
    // loop
    a = i;
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.