Reduce and Spread vs ForEach and Mutate (for .. in loop) vs Mutate with Object.assign vs Foreach and Mutate (Object.assign)Fastest: ForEach and Mutate (for .. in loop) (16.9x faster)
143,882 ops/sec
103,080 ops/sec
56,843 ops/sec
8,496 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Reduce and Spread | |
| ForEach and Mutate (for .. in loop) | |
| Mutate with Object.assign | |
| Foreach and Mutate (Object.assign) |
| Test name | Executions per second |
|---|---|
| ✓ Mutate with Object.assign | 11,275 Ops/sec |
| Foreach and Mutate (Object.assign) | 8,906 Ops/sec |
| Reduce and Spread | 5,187 Ops/sec |
| ForEach and Mutate (for .. in loop) | 1,096 Ops/sec |