jQuery 1 vs jQuery 2

JavaScript performance comparison

Revision 16 of this test case created

Preparation code

<script src="//code.jquery.com/jquery-git1.js"></script>
<script src="//code.jquery.com/jquery-git2.js"></script>
<script>
  var jQ1 = jQuery.noConflict();
</script>
<script>
  var jQ2 = jQuery.noConflict();
</script>
<div id="idSelector"></div>
<div class="classSelector"></div>
<ul id="iteration">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>
<div id="cssGetter" style="color: black;"></div>
<div id="cssSetter" style="color: black;"></div>
<div id="find">
    <span></span>
    <div>
        <strong></strong>
    </div>
</div>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
ID Selector jQuery 1
jQ1('#idSelector');
pending…
ID Selector jQuery 2
jQ2('#idSelector');
pending…
Class Selector jQuery 1
jQ1('.classSelector');
pending…
Class Selector jQuery 2
jQ2('.classSelector');
pending…
Iteration jQuery 1
jQ1('#iteration li').each(function(i, e) {
  i++;
});
pending…
Iteration jQuery 2
jQ2('#iteration li').each(function(i, e) {
  i++;
});
pending…
CSS Getter jQuery 1
jQ1('#cssGetter').css('color');
pending…
CSS Getter jQuery 2
jQ2('#cssGetter').css('color');
pending…
CSS Setter jQuery 1
jQ1('#cssSetter').css('color', 'red');
pending…
CSS Setter jQuery 2
jQ2('#cssSetter').css('color', 'red');
pending…
Find jQuery 1
jQ1('#find').find('strong');
pending…
Find jQuery 2
jQ2('#find').find('strong');
pending…
Non-existent ID jQuery 1
jQ1('#someID');
pending…
Non-existent ID jQuery 2
jQ2('#someID');
pending…
Non-existent Class jQuery 1
jQ1('.someClass');
pending…
Non-existent Class jQuery 2
jQ2('.someClass');
pending…
Filter-next-prev jQuery 1
jQ1('#iteration li').filter(':first').next();
jQ1('#iteration li').filter(':last').prev();
pending…
Filter-next-prev jQuery 2
jQ2('#iteration li').filter(':first').next();
jQ2('#iteration li').filter(':last').prev();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment