Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 Edg/83.0.478.61
Chrome 83
Windows
Desktop
4 years ago
Test name Executions per second
forEach #1 293544.6 Ops/sec
fromEntries and map #1 150788.8 Ops/sec
Object.assign and map #1 166080.7 Ops/sec
reduce #1 177658.3 Ops/sec
for 129026.4 Ops/sec
forEach #2 268055.0 Ops/sec
fromEntries and map #2 147701.3 Ops/sec
Object.assign and map #2 151209.9 Ops/sec
reduce #2 173951.4 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