eof loop cache (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  var items = [1,2,3,4,5,6,7,8,9], 
      devNull, 
      divs = document.querySelectorAll('div'),
      deadDivs = Array.prototype.slice.call(divs);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
cache
for (var i = 0, c = items.length; i < c; i++) {
    devNull = items[i] * 2;
}
ready
no cache
for (var i = 0; i < items.length; i++) {
    devNull = items[i] * 2;
}
ready
NodeList cache
for (var i = 0, c = divs.length; i < c; i++) {
    devNull = divs[i];
}
ready
NodeList no cache
for (var i = 0; i < divs.length; i++) {
    devNull = divs[i];
}
ready
Array NodeList cache
for (var i = 0, c = deadDivs.length; i < c; i++) {
    devNull = deadDivs[i];
}
ready
Array NodeList no cache
for (var i = 0; i < deadDivs.length; i++) {
    devNull = deadDivs[i];
}
ready

Revisions

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