while vs for 001122

JavaScript performance comparison

Test case created by stefano solinas

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
while not casting i++
var i = 10000000,
    count = 0;
while (i != 0) {
  count++;
  i--;
}
pending…
for not casting i--
var i, count = 0;
for (i = 0; i != 10000000; i++) {
  count++;
}
pending…
for not casting
var i, count = 0;
for (i = 10000000; i != 0; i--) {
  count++;
}
pending…
for <=
var i, count = 0;
for (i = 10000000; i >= 0; i--) {
  count++;
}
pending…

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

Compare results of other browsers

0 comments

Add a comment