Simple Loop Optimizations (v2)

Revision 2 of this benchmark created by Julius on


Setup

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

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
for (var i = 0, l = catPictures.length; 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.