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 257940.0 Ops/sec
fromEntries and map #1 147642.4 Ops/sec
Object.assign and map #1 143200.2 Ops/sec
reduce #1 191913.1 Ops/sec
for 129271.5 Ops/sec
forEach #2 215799.6 Ops/sec
fromEntries and map #2 156704.1 Ops/sec
Object.assign and map #2 143820.1 Ops/sec
reduce #2 163642.0 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