jquery-find-vs-children-and-id-selector (v10)

Revision 10 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo"> 
  <div>
    <p id="one">blah</p>
  </div>
  <div>
    <p id="two">blah</p>
  </div>
  <div>
    <p id="three">blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
</div>
<div id="bar"> 
  <div>
    <p id="four">blah</p>
  </div>
  <div>
    <p id="five">blah</p>
  </div>
  <div>
    <p id="six">blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
find
$('#foo #one');
ready
find, child selector
$('#foo > #one');
ready
find, child selector 2
$('#one')
ready
children + children
$('#foo').children().children('p');
ready
child selector + children
$('#foo > div').children('p');
ready
child combinators only
$('#foo > div > p');
ready
Two descendant combinators
$('#foo div p');
ready
One descendant combinator
$('#foo p');
ready

Revisions

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