jQuery.each vs. for loop (v109)

Revision 109 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.each
$.each(a, function() {
  var e = this;
});
ready
for loop
for (var i = 0, len = a.length; i < len; i++) {
  var e = a[i];
};
ready
xeach
var xeach = function(items, callback) {
    for (var i = 0, len = items.length; value = items[i], i < len; i++) {
      callback.apply(value);
    }
    };
xeach(a, function() {
  var e = this;
});​
ready

Revisions

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