test before each

Benchmark created on


Description

Is a test with .size() needed before calling .each() ?

Preparation HTML

<div></div>
<div></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
  var $collection = $('div');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
test size
if ($collection.size()) {
  $collection.each(function () { });
}
ready
no check for size
  $collection.each(function () { });
ready

Revisions

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