Script Preparation code:
x
 
var obj = {};
for (i = 0; i < 1000; ++i) {
  obj[i] = i;
}
Tests:
  • object with keys

     
    Object.keys(obj).forEach(
      (key) => key,
    );
  • object with values

     
    Object.values(obj).forEach(
      (value) => value,
    );
  • object with entries 1

     
    Object.entries(obj).forEach(
      (entry) => entry,
    );
  • object with entries 2

     
    Object.entries(obj).forEach(
      ([key, value]) => [key, value],
    );
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    object with keys
    object with values
    object with entries 1
    object with entries 2

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
object with keys 82553.4 Ops/sec
object with values 427565.7 Ops/sec
object with entries 1 22376.0 Ops/sec
object with entries 2 20803.4 Ops/sec