while-vs-for (v32)

Revision 32 of this benchmark created on


Setup

var arr = [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9];

Test runner

Ready to run.

Testing in
TestOps/sec
while
var l = arr.length,
    b = [];

while (l--) {
    b[l] = arr[l];
}
ready
for
var i = 0,
    l = arr.length.
    b = [];

for (; i < l; i+=1) {
   b[l] = arr[l];
}
ready

Revisions

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