jQuery Selector Perf - Right-to-Left

JavaScript performance comparison

Revision 63 of this test case created

Preparation code

<div id="box">
  <div>
    <div>
      <div>
        <div>
          <p>Hello</p>
          <p>World!</p>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
  var $box = $('#box');
</script>

Preparation code output

Hello

World!

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
single selector
$('#box p');
pending…
ID then children
$('#box').children('p');
pending…
ID then find
$('#box').find('p');
pending…
cached context
var i = $('p', $box);
alert(i);
 
pending…
cached find
$box.find('p');
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