loops - while vs for (v11)

Revision 11 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
while loop
var i = 1000;
while (i > 0) {
 i--;
}
ready
for loop
for (var i = 1000; i > 0; i--) {

}
ready
while loop 2
var i = 1000;
while (i--) {

}
ready
for loop 2
for (var i = 1000; i > 0;) {
 i--
}
ready
standard for
for (var i = 0; i < 1000; i++) {

}
ready
do while
var i = 1000;
do {

} while (i--);
ready

Revisions

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