Script Preparation code:
AخA
 
var obj = {
  'a': {
    id: 'a',
    num: 1
  },
  'b': {
    id: 'b',
    num: 1
  },
  'c': {
    id: 'c',
    num: 1
  },
  'd': {
    id: 'd',
    num: 1
  },
  'e': {
    id: 'e',
    num: 1
  },
  'f': {
    id: 'f',
    num: 1
  },
  'g': {
    id: 'g',
    num: 1
  },
};
Tests:
  • for-in

     
    for (var i=10000; i > 0; i--) {
      for (var key in obj) {
          console.log(obj[key].id); 
      }
    }
  • Object.values

     
    for (var i=10000; i > 0; i--) {
      const values = Object.values(obj);
      for (n of values) {
       console.log(n.id)
      }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    for-in
    Object.values

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
for-in 8.8 Ops/sec
Object.values 7.7 Ops/sec