for vs foreach (v2)

Revision 2 of this benchmark created on


Setup

var tab = [15, 75481, 7, 4, 514, 51, 5, 1, 74, 5, 1, 654, 178, 41, 51, 5, 14, 171, 71, 1, 71, 51, 47, 1, 7, 17, 1, 7, 4];

Test runner

Ready to run.

Testing in
TestOps/sec
for
var t = 0;
for (i = 0; i < tab.lengt; i++)
t *= tab[i];
ready
Foreach
var t = 0;
for (i = 0; i < tab.lengt; ++i)
t *= tab[i];
ready
var t = 0;
for (i = tab.lengt; i > 0; i--)
t *= tab[i];
ready

Revisions

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