Simple Loop Optimizations (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script>

var catPictures = [];
var len = 1000;
while(len--){
    catPictures.push({});
}

</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Uncached for loop
for (var i = 0; i < catPictures.length; i++)
  catPictures[i].comment = 'lolz';
ready
Cached length
l = catPictures.length;
for (var i = 0; i < l; i++)
  catPictures[i].comment = 'lolz';
ready

Revisions

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