jQuery 1.6.4 vs 1.9.1 (v14)

Revision 14 of this benchmark created on


Description

Ref. http://jsperf.com/jquery-15-unique-traversal

Preparation HTML

<script src="//code.jquery.com/jquery-1.6.4.min.js">
</script>
<script>
  var $164 = jQuery.noConflict();
</script>
<script src="//code.jquery.com/jquery-1.9.1.min.js">
</script>
<script>
  var $191 = jQuery.noConflict();
</script>


<input id="val" type="text" value="foo">
<div id="children" style="display:none;">
</div>
<script>
  var i, j, html = "";
  for (j = 0; j < 20; j++) {
    html += "<div class='children'>";
    for (i = 0; i < 5; i++) {
      html += "<div>abc</div><div>012</div>";
    }
    html += "</div>";
  }

  document.getElementById("children").innerHTML = html;
</script>
<div id="id-outer">
  <div id="id-inner">
  </div>
</div>

Setup

var $164val = $164('#val');
    var $191val = $191('#val');
    
    var $164children = $164(".children");
    var $191children = $191(".children");
    
    var $164outer = $164('#id-outer');
    var $191outer = $191('#id-outer');

Test runner

Ready to run.

Testing in
TestOps/sec
1.6.4
$164val.val();
$164('#id-inner');
$164children.children();
$164outer.find('#id-inner');
ready
1.9.1
$191children.children();
$191outer.find('#id-inner');
$191('#id-inner');
$191val.val();
ready

Revisions

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