copy for condition

Benchmark created by Illz on


Description

I´d like to ckeck wether a for loop runs faster when you copy the condition value into a new one bevor the loop starts. At least it does ...

Preparation HTML

<script>
  var myarray = [];
  for (var x = 0; x <= 300000; x++) {
   myarray.push(i);
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
normal loop
for (var x = 0; x < myarray.length; x++) {

}
ready
copy and loop
for (var x = 0, l = myarray.length; x < l; x++) {

}
ready

Revisions

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