Selectors perf 3 (v31)

Revision 31 of this benchmark created by Quentin Giraud 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="https://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
Find
var xxx = $('#childDiv').find('.txtClass');
ready
Class Selector
var xx = $('.txtClass');
ready
querySelectorAll
var obj = document.querySelectorAll('.txtClass');
ready
ClassDirect
var obj = document.getElementsByClassName('txtClass');
ready
Direct
var obj = document.getElementById('childDiv');
xxx = obj.getElementsByClassName('txtClass');
ready

Revisions

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