jQuery.each vs. for loop (v125)

Revision 125 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
  var a = {
    a: 1,
    b: 2,
    c: 3,
    d: 4,
    e: 5,
    f: 6,
    g: 7,
    h: 8
  },
      e;
</script>

Test runner

Ready to run.

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

Revisions

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