jQuery Selectors vs Find (v14)

Revision 14 of this benchmark created by Denis Denisov on


Preparation HTML

<div>
  <ul id="list">
    <li class="test1"></li>

    <li class="test2"></li>

    <li class="test3"></li>

    <li class="test4"></li>

    <li class="test5"></li>

    <li id="test"></li>

  </ul>
</div>

<div class="test"></div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
selectors
var $test1 = $('.test1'),
    $test2 = $('.test2'),
    $test3 = $('.test3'),
    $test4 = $('.test4'),
    $test5 = $('.test5'),
    $test = $('#test1');
ready
find
var $list = $('#list'),
    $test1 = $list.find('.test1'),
    $test2 = $list.find('.test2'),
    $test3 = $list.find('.test3'),
    $test4 = $list.find('.test4'),
    $test5 = $list.find('.test5'),
    $test = $list.find('#test1');
ready

Revisions

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