jQuery vs. document.querySelector (v27)

Revision 27 of this benchmark created by Søren 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="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js"></script>

Test runner

Ready to run.

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

Revisions

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