jQuery Selector Perf - Right-to-Left

JavaScript performance comparison

Revision 97 of this test case created

Preparation code

<div id="box">
  <div class="inner-box"> Hi </div>
</div>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var box = $('#box');
</script>

Preparation code output

Hi

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Raw JS
document.getElementById("box").getElementsByTagName("div");
pending…
"Right to Left"
$('#box').children('.inner-box');
$('#box').children('.inner-box');
pending…
Alternate "Right to Left"
$('#box').find('.inner-box');
$('#box').find('.inner-box');
pending…
jQuery Context
$('.inner-box', $('#box'));
$('.inner-box', $('#box'));
pending…
Selector Context
$('.inner-box', '#box');
$('.inner-box', '#box');
pending…
Predefined Context
$('.inner-box', box);
$('.inner-box', box);
pending…
Predefined Find
box.find('.inner-box');
box.find('.inner-box');
pending…
Child Selector
$('#box > .inner-box');
$('#box > .inner-box');
pending…
Child
$('#box .inner-box');
$('#box .inner-box');
pending…
Class direct
$('.inner-box');
$('.inner-box');
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