For or while (v17)

Revision 17 of this benchmark created by asdasd on


Preparation HTML

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

Test runner

Ready to run.

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

Revisions

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