forEach vs $.fn.each (v2)

Revision 2 of this benchmark created by bradw 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 $brs = $('br');

Test runner

Ready to run.

Testing in
TestOps/sec
$.fn.each
$brs.each(function() {
    $.noop();
});
ready
forEach
[].forEach.call($brs, function() {
    $.noop();
});
ready
for..in
$brs.forEach(function () {
  $.noop();
});
ready
iterable
for ($br of $brs) {
  $.noop();
}
ready

Revisions

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