various jquery vs js

JavaScript performance comparison

Test case created by stefano solinas

Preparation code

<div id="test">
  Hello
</div>

Preparation code output

Hello

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
for with inside creation
var count = 0;
for (var i = 0; i < 10000000; i++) {
  count++;
}
pending…
for with outside creation
var i = 0,
    count = 0;
for (; i < 10000000; i++) {
  count++;
}
pending…
for with <=
var i = 0,
    count = 0;
for (; i <= 10000000; i++) {
  count++;
}
pending…
i decreasing
var i = 10000000,
    count = 0;
for (; i; i--) {
  count++;
}
pending…
while decreasing
var i = 10000000,
    count = 0;
while (i--) {
  count++;
}
pending…
while not casting
var i = 10000000,
    count = 0;
while (i == 0) {
  count++;
  i--;
}
pending…
while not casting 2
var i = 10000000,
    count = 0;
while (i-- == 0) {
  count++;
}
pending…
do while
var i = 10000000,
    count = 0;
do {
  count++;
}while (i-- == 0)
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