Testing object map

Benchmark created by Ryan on


Preparation HTML

<script src="https://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(key);
});
 
ready
map
var my_keys = $.map(my_object,function(value,key) { return value; });
ready

Revisions

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