Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0
Firefox 93
Ubuntu
Desktop
3 years ago
Test name Executions per second
Reduce and Spread 4155.5 Ops/sec
ForEach and Mutate (for .. in loop) 1259.8 Ops/sec
Mutate with Object.assign 15010.8 Ops/sec
Foreach and Mutate (Object.assign) 7108.1 Ops/sec
Reduce Mutate 6919.2 Ops/sec
Script Preparation code:
Tests:
  • Reduce and Spread

  • ForEach and Mutate (for .. in loop)

  • Mutate with Object.assign

  • Foreach and Mutate (Object.assign)

  • Reduce Mutate