Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Chrome 53
Mac OS X 10.12.0
Other
8 years ago
Test name Executions per second
For in 1348457.5 Ops/sec
Obj.keys for loop 947736.2 Ops/sec
Object.keys reduce 789493.8 Ops/sec
For in function 3749325.0 Ops/sec
Object.keys for loop function 1559562.9 Ops/sec
Object.keys reduce function 1153872.0 Ops/sec
Object.keys for loop 2 263263.9 Ops/sec
Script Preparation code:
Tests:
  • For in

  • Obj.keys for loop

  • Object.keys reduce

  • For in function

  • Object.keys for loop function

  • Object.keys reduce function

  • Object.keys for loop 2