For or while (v10)

Revision 10 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
for
for (var i = 0; i <= len; i++) {
  cnt++;
}
 
ready
while
var i = foo.length;
while (i--) {
  cnt++;
}
 
ready
reverse for
for (var i = foo.length; i--;) {
  cnt++;
}
 
ready

Revisions

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