jQuery 1 vs jQuery 2

JavaScript performance comparison

Revision 15 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>
</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
1 ID Selector
jQ1("#idSelector");
pending…
2 ID Selector
jQ2("#idSelector");
pending…
1 Class Selector
jQ1(".classSelector");
pending…
2 Class Selector
jQ2(".classSelector");
pending…
1 Iteration
jQ1("#iteration li").each(function(i, e) {
  i++;
});
pending…
2 Iteration
jQ2("#iteration li").each(function(i, e) {
  i++;
});
pending…
1 CSS Getter
jQ1("#cssGetter").css("color");
pending…
2 CSS Getter
jQ2("#cssGetter").css("color");
pending…
1 CSS Setter
jQ1("#cssSetter").css("color", "red");
pending…
2 CSS Setter
jQ2("#cssSetter").css("color", "red");
pending…
1 Find
jQ1("#find").find("strong");
pending…
2 Find
jQ2("#find").find("strong");
pending…
1 Non-existent ID
jQ1("#someID");
pending…
2 Non-existent ID
jQ2("#someID");
pending…
1 Non-existent Class
jQ1(".someClass");
pending…
2 Non-existent Class
jQ2(".someClass");
pending…
1 Filter-next-prev
jQ1("#iteration li").filter(":first").next();
jQ1("#iteration li").filter(":last").prev();
pending…
2 Filter-next-prev
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