jQuery .find() vs descendant selector (v33)

Revision 33 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div>
<div id="container">
<div></div>
<div></div>
<div class="robotarm"></div>
<div><div class="robotarm"></div></div>
<div class="robotarm"></div>
<div class="robotarm"></div>
<div></div>
</div>
</div>

Setup

var cache = $('#container');

Test runner

Ready to run.

Testing in
TestOps/sec
Descendant Selector
$('#container .robotarm');
ready
Find
$('#container').find('.robotarm');
ready
Global Find
$.find('#container .robotarm');
ready
Speed Find
$.find('.robotarm');
ready
Direct Access
$('.robotarm');
ready
Cached Descendant
cache.find('.robotarm');
ready

Revisions

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