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

Revision 5 of this benchmark created by Martijn on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo"> 
  <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>
    <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>
    <p>blah</p>
  </div>
  <div>
    <p>blah</p>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
find
$('#foo').find('p');
ready
find, child selector
$('#foo > div').find('p');
ready
find, child selector 2
$('#foo').find('> div p');
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.