Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Windows
Desktop
2 years ago
Test name Executions per second
forEach #1 653428.8 Ops/sec
fromEntries and map #1 561566.4 Ops/sec
Object.assign and map #1 327383.6 Ops/sec
reduce #1 353210.2 Ops/sec
for 311469.0 Ops/sec
forEach #2 699866.8 Ops/sec
fromEntries and map #2 567187.7 Ops/sec
Object.assign and map #2 335731.7 Ops/sec
reduce #2 365337.5 Ops/sec
Script Preparation code:
Tests:
  • forEach #1

  • fromEntries and map #1

  • Object.assign and map #1

  • reduce #1

  • for

  • forEach #2

  • fromEntries and map #2

  • Object.assign and map #2

  • reduce #2