Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
forEach #1 1190066.4 Ops/sec
fromEntries and map #1 680213.3 Ops/sec
Object.assign and map #1 636636.6 Ops/sec
reduce #1 695147.9 Ops/sec
for 547071.1 Ops/sec
forEach #2 1192613.6 Ops/sec
fromEntries and map #2 685520.3 Ops/sec
Object.assign and map #2 634280.0 Ops/sec
reduce #2 642762.6 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