forEach vs $.fn.each (v3)

Revision 3 of this benchmark created on


Preparation HTML

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

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

Setup

var brArr = $.makeArray($('br'));

Test runner

Ready to run.

Testing in
TestOps/sec
$.fn.each
$.each(brArr, function () {
  $.noop();
});
ready
forEach
brArr.forEach(function() {
   $.noop();
});
ready
iterable
for ( item of brArr.entries()) {
  $.noop();
}
ready

Revisions

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