while or do while()

Benchmark created by Hideto Manjo on


Preparation HTML

<script>
  var arr = [];
  for (var i = 0; i < 1000; i++) {
    arr[i] = i;
  }

  function F(x) {
    return x * 5;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
while length--
var l = arr.length;
while(l--) {
  F(arr[l]);
}
ready
do while
var l = arr.length;
do{
  F(arr[l]);
}while(l--)
ready
do while 2
var l = arr.length;
var i=0;
do{
  F(arr[i]);
  i = i + 1;
}while(i < l)
ready

Revisions

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

  • Revision 1: published by Hideto Manjo on