Get object keys (v4)

Revision 4 of this benchmark created on

Preparation HTML

<script src="//"></script>

  var theObject = {
  a: 'Some value',
  aa: 'Some value',
  aaa: 'Some value',
  aaaa: 'Some value',
  aaaaa: 'Some value',
  aaaaaa: 'Some value',
  aaaaaaa: 'Some value',
  aaaaaaaa: 'Some value',
  ba: 'Some value',
  bba: 'Some value',
  bbba: 'Some value',
  bbbba: 'Some value',
  bbbbba: 'Some value',
  bbbbbba: 'Some value',
  bbbbbbba: 'Some value',
  bbbbbbbba: 'Some value',
  ca: 'Some value',
  cca: 'Some value',
  ccca: 'Some value',
  cccca: 'Some value',
  ccccca: 'Some value',
  cccccca: 'Some value',
  ccccccca: 'Some value',
  cccccccca: 'Some value',
  cccccccccca: 'Some value',
  da: 'Some value',
  dda: 'Some value',
  ddda: 'Some value',
  dddda: 'Some value',
  ddddda: 'Some value',
  dddddda: 'Some value',
  ddddddda: 'Some value',
  dddddddda: 'Some value',
  ddddddddda: 'Some value',
  dddddddddda: 'Some value',
  ddddddddddda: 'Some value',
  dddddddddddda: 'Some value',
  ea: 'Some value',
  eaa: 'Some value',
  eaaa: 'Some value',
  eaaaa: 'Some value',
  eaaaaa: 'Some value',
  eaaaaaa: 'Some value',
  eaaaaaaa: 'Some value',
  eaaaaaaaa: 'Some value',
  eba: 'Some value',
  ebba: 'Some value',
  ebbba: 'Some value',
  ebbbba: 'Some value',
  ebbbbba: 'Some value',
  ebbbbbba: 'Some value',
  ebbbbbbba: 'Some value',
  ebbbbbbbba: 'Some value',
  eca: 'Some value',
  ecca: 'Some value',
  eccca: 'Some value',
  ecccca: 'Some value',
  eccccca: 'Some value',
  ecccccca: 'Some value',
  eccccccca: 'Some value',
  ecccccccca: 'Some value',
  ecccccccccca: 'Some value',
  eda: 'Some value',
  edda: 'Some value',
  eddda: 'Some value',
  edddda: 'Some value',
  eddddda: 'Some value',
  edddddda: 'Some value',
  eddddddda: 'Some value',
  edddddddda: 'Some value',
  eddddddddda: 'Some value',
  edddddddddda: 'Some value',
  eddddddddddda: 'Some value',
  edddddddddddda: 'Some value'}

Test runner

Ready to run.

Testing in
keep track of key
var keys = [];
var i = 0;
for(key in theObject) {keys[i] = key; i++;}
var keys = [];
for(key in theObject) {keys.push(key);}
user length for index
var keys = [];
for(key in theObject) {keys[keys.length] = key;}
use jQuery map
var keys = $.map(theObject, function(value, key) {return key;});
use Object.keys
var keys = Object.keys(theObject);


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