.find() Versus Selectors (v4)

Revision 4 of this benchmark created on


Description

Will the battle never end?

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="null">
</div>
<div id="a">
  <div class="null">
  </div>
  <div class="null">
  </div>
  <div class="null">
  </div>
  <div class="a">
    <div class="c">
      <div class="null">
      </div>
      <div class="b">
      </div>
      <div class="null">
      </div>
    </div>
    <div class="null">
    </div>
  </div>
</div>

Setup

var $a = $('#a');

Test runner

Ready to run.

Testing in
TestOps/sec
Selector
$('#a .b');
ready
Context
$('.b', $('#a'));
ready
.find()
$('#a').find('.b')
ready
Cached .find()
$a.find('.b')
ready
Cached Context
$('.b', $a)
ready
Speed .find()
$.find('.b');
ready
Speed .find() with context
$.find('.b', $a);
ready
$.find version of "selector"
$.find('#a .b');
ready
Just '.b'
$('.b');
ready

Revisions

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