jQuery vs. document.querySelector (v37)

Revision 37 of this benchmark created on


Description

I know its been done before. Just want to see for myself

Preparation HTML

<div id="main">
  <ul class="gallery">
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
    <li>
      Hello World
    </li>
  </ul>
</div>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>

Teardown


    var el = document.querySelector("#main ul:first-child");
  

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
var el = $("#main ul:first-child");
ready
DOM
function $2(query) {
  return document.querySelector(query);
}
var el = $2("#main ul:first-child");
ready

Revisions

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