jquery .each vs .find attribute (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<ul id="testme">
  <li value="1">
  </li>
  <li value="12">
  </li>
  <li value="122">
  </li>
  <li value="1222">
  </li>
  <li value="12222">
  </li>
  <li value="122222">
  </li>
  <li value="1222222">
  </li>
  <li value="12222222">
  </li>
  <li value="122222222">
  </li>
  <li value="1222222222">
  </li>
  <li value="12222222222">
  </li>
  <li value="20">
  </li>
</ul>

Setup

var MyValue = "20";

Test runner

Ready to run.

Testing in
TestOps/sec
each
$.each($("#testme li"), function() {
  $(this).text('pepe');
});
ready
find
$("#testme").find("li").text('pepe');
ready
each find
$.each($("#testme").find("li"), function() {
  $(this).text('pepe');
});
ready

Revisions

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