jquery .each VS for loops (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js">
</script>

Setup

var collection = {
      1: 'bum',
      2: 'poo',
      3: 'pee',
      4: 'whore',
      5: 'hives',
      6: 'dicks',
      iLike: 'cheese'
    };
    var value;

Test runner

Ready to run.

Testing in
TestOps/sec
$.each
$.each(collection, function(key, val) {});
ready
_.each
_.each(collection, function(val, key) {});
ready
for ( in )
for (i in collection) {
  value = collection[i];
}
ready

Revisions

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