Loop over object: lodash vs Object.entries and Object.keys

one month ago
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Test name Executions per second
lodash.each 2537.4 Ops/sec
lodash.map 2104.6 Ops/sec
Object.entries.forEach 819.6 Ops/sec
vanilla for-loop w/ Object.entries 994.0 Ops/sec
Object.keys.forEach 668.6 Ops/sec
vanilla for-loop w/ Object.keys 756.1 Ops/sec
for in 679.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • lodash.each

  • lodash.map

  • Object.entries.forEach

  • vanilla for-loop w/ Object.entries

  • Object.keys.forEach

  • vanilla for-loop w/ Object.keys

  • for in

Open this result on MeasureThat.net