jquery find multiple vs multiple finds

Benchmark created by Frederik on


Description

Using the jquery multi-selector with find vs just multiple find lines.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="start">
<div>
   <p id="element1">Hey</p>
</div>
<div>
   <p id="element2">Hello</p>
</div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Find Multiple
$("#start").find("#element1, #element2").click(function() {
  alert("hoi");
});
ready
Multiple Finds
$("#start").find("#element1").click(function() {
  alert("hoi");
});
$("#start").find("#element2").click(function() {
  alert("hoi");
});
ready

Revisions

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

  • Revision 1: published by Frederik on