jQuery vs querySelectorAll (v59)

Revision 59 of this benchmark created on


Preparation HTML

<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
</head>
<body>
<ul id="list">
<li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li>
<li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li><li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li><li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li>
</ul>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery
$("#list .sublist li");
ready
querySelectorAll
document.querySelectorAll("#list .sublist li");
ready
jquery find
$("#list").find(".sublist").find("li");
ready
jquery single find
$("#list").find(".sublist li");
ready
querySelectorAll 2
var el = document.getElementById("list");
el.querySelectorAll(".sublist li");
ready

Revisions

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