$.map vs $.each (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var collection = {};
  
  for (var i = 0; i < 10000; i++) {
   collection[i] = Math.random();
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$.map
var _array = $.map(collection, function(value, key) {
 return value;
});
ready
$.each
var _array = [];

$.each(collection, function(key, value) {
 _array.push(value);
});
ready

Revisions

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