Using the spread operator vs Using Object.assign vs New objectFastest: New object (3.7x faster)
186,525,808 ops/sec
72,860,472 ops/sec
50,222,424 ops/sec
Fastest: New object (126.9x faster)
1,934,041,472 ops/sec
24,622,372 ops/sec
15,235,266 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Using the spread operator | |
| Using Object.assign | |
| New object |
| Test name | Executions per second |
|---|---|
| ✓ New object | 1,044,408,768 Ops/sec |
| Using the spread operator | 155,419,168 Ops/sec |
| Using Object.assign | 89,004,232 Ops/sec |