Spread operator (...) vs JSON.parse(JSON.stringify()) vs Custom function vs Lodash.cloneDeep() vs jQuery.extend(true) vs structuredClone()Fastest: Spread operator (...) (208.4x faster)
3,160 ops/sec
2,906 ops/sec
2,667 ops/sec
1,408 ops/sec
23 ops/sec
15 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Spread operator (...) | |
| JSON.parse(JSON.stringify()) | |
| Custom function | |
| Lodash.cloneDeep() | |
| jQuery.extend(true) | |
| structuredClone() |
| Test name | Executions per second |
|---|---|
| ✓ jQuery.extend(true) | 3,830 Ops/sec |
| Spread operator (...) | 3,676 Ops/sec |
| Lodash.cloneDeep() | 3,651 Ops/sec |
| structuredClone() | 1,867 Ops/sec |
| Custom function | 45 Ops/sec |
| JSON.parse(JSON.stringify()) | 20 Ops/sec |