fiddle - A7c6G

JavaScript performance comparison

Test case created by Zword

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<ul>
    <li>hello</li>
    <li>hello</li>
    <li>hello</li>
    <li>hello</li>
</ul>

Preparation code output

  • hello
  • hello
  • hello
  • 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
Ans -1
$('ul li:odd').css('background-color','red');
pending…
Ans -2
$('ul li').filter(':odd').css('background-color','red');
pending…
Ans -3
$('ul li:nth-child(2n+2)').css('background-color','red');
pending…
Ans -4
$('ul li').filter(':nth-child(2n+2)').css('background-color','red');
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