Testing object map (v3)

Revision 3 of this benchmark created on


Preparation HTML

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

<script>
  var my_object = {
    this : 'that',
    the : 'other',
    foo : 'bar',
    bar : 'baz',
    bam : 'bam',
    boom : 'boom',
    bear : 'bear',
    bat : 'bat'
  }
</script>

Test runner

Ready to run.

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

my_keys = $.grep(my_object, function(key, value) {
 return value;
});
ready
each2
var my_keys = [];
$(my_object).each(function(key,value) {
   my_keys.push(value);
});
ready

Revisions

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