jQuery.each vs. for loop (v132)

Revision 132 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  $.fn.forEach = Array.prototype.forEach;
  var a = $('*');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.each
$.each(a, function(index, node) {
 var e = node;
});
ready
for loop
for (var i = 0, len = a.length; i < len; i++) {
 var e = a[i];
};
ready
forEach
a.forEach(function(node, index){
 var e = node;
});
ready

Revisions

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