jquery selector speed

Benchmark created by tsb on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="test">
  <div class="test2">
    <a href="#">
    <div>adsf</div>
    </a>
  </div>
  <div class="test3">
    <a href="#">
    <div>adsf</div>
    </a>
  </div>
  <div class="test4">
    <a href="#">
    <div>adsf</div>
    </a>
  </div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
find
$("#test").find("div > a");
ready
children
$("#test").children("div").children("a");
ready
onefind
$("#test div");
ready
$("#test div > a");
ready
$("#test").find("div")
ready
$("div", $("#test"));
ready

Revisions

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