For or while (v14)

Revision 14 of this benchmark created on


Preparation HTML

<script>
  var foo = [1, 2, 3];
  var cnt = 0;
  var test = foo.length;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
for
for (var i = 0; i <= test; i++) {
  cnt++;
}
 
ready
while
var i = test;
while (i--) {
  cnt++;
}
 
ready
reverse for
for (var i = test; i > 0; i--) {
  cnt++;
}
 
ready

Revisions

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