Selectors perf 3 (v5)

Revision 5 of this benchmark created on


Preparation HTML

<div id="childDiv">
        <input type="text" id="txtID" class="txtClass">
          Why Right to Left Thinking is Good
        </input>
        <p class="child">
          Blah Blah Blah
        </p>
      </div>
     
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script >
var $div = $('#childDiv');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
class selector
var xx = $('.txtClass');
ready
ID desend
var xxx = $('#childDiv .txtClass');
ready
ID desend 2
var xxx = $('#childDiv > .txtClass');
ready
element prefix
var xxx = $('input.txtClass');
ready
Find
var xxx = $('#childDiv').find('.txtClass');
ready
With context
var xxx = $('.txtClass',$('#childDiv'));
ready
element
var xxx = $('input');
ready

Revisions

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