for(o in objects) vs. $.each(objects)

Benchmark created on


Preparation HTML

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

Setup

var object = {};
    for (var i = 0; i < 1000000; i++) {
      object['member' + i] = 'value' + i;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
each
$.each(object, function() {});
ready
for
for (member in object) {}
ready

Revisions

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