compare for loop speed

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
for usual
const array = [920, 168, 892, 195, 205, 494, 145, 501, 722, 700, 658, 452, 639, 394, 463, 421, 478, 824, 840, 697, 176, 984, 744, 451, 292, 907, 935, 446, 171, 640, 408, 66, 918, 414, 568, 650, 490, 25, 177, 353, 481, 494, 293, 844, 237, 329, 818, 67, 331, 982, 400, 496, 82, 584, 96, 657, 378, 751, 222, 843, 625, 106, 648, 25, 579, 18, 157, 88, 936, 56, 988, 68, 675, 961, 760, 632, 289, 918, 861, 2, 993, 426, 431, 391, 981, 589, 818, 940, 716, 478, 556, 473, 989, 771, 467, 790, 838, 935, 200, 815];
for (let index = 0; index < array.length; index++) {
    let element = array[index];
    array[index] = element++;
}
ready
for reverse
const array = [920, 168, 892, 195, 205, 494, 145, 501, 722, 700, 658, 452, 639, 394, 463, 421, 478, 824, 840, 697, 176, 984, 744, 451, 292, 907, 935, 446, 171, 640, 408, 66, 918, 414, 568, 650, 490, 25, 177, 353, 481, 494, 293, 844, 237, 329, 818, 67, 331, 982, 400, 496, 82, 584, 96, 657, 378, 751, 222, 843, 625, 106, 648, 25, 579, 18, 157, 88, 936, 56, 988, 68, 675, 961, 760, 632, 289, 918, 861, 2, 993, 426, 431, 391, 981, 589, 818, 940, 716, 478, 556, 473, 989, 771, 467, 790, 838, 935, 200, 815];

for (let index = array.length -1; index >=0 ; index--) {
    let element = array[index];
    array[index] = element++;
}
ready

Revisions

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