for loop optimisation

Benchmark created on


Preparation HTML

<ul id="list"><ul>
<script>
  var ul = document.getElementById('list');
  for(var i=0;i<10000;i++)
       ul.appendChild(document.createElement('li'));
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
optimised
for(var i=0,l=ul.childElementCount;i<l;i++){}
ready
non-optimised
for(var i=0;i<ul.childElementCount;i++){}
ready

Revisions

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