Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Mobile Safari/537.36
Chrome Mobile 121
Android
Mobile
2 years ago
JSON.parse(JSON.stringify(num))
413K/s
structuredClone(num)
142K/s
structuredClone(obj)
43K/s
JSON.parse(JSON.stringify(obj))
42K/s
View exact numbers
| Test name |
Executions per second |
|
✓
_.cloneDeep(num)
|
879,511 Ops/sec |
|
JSON.parse(JSON.stringify(num))
|
413,144 Ops/sec |
|
structuredClone(num)
|
141,848 Ops/sec |
|
structuredClone(obj)
|
42,642 Ops/sec |
|
JSON.parse(JSON.stringify(obj))
|
41,950 Ops/sec |
|
_.cloneDeep(obj)
|
36,246 Ops/sec |
Tests:
-
_.cloneDeep(obj)
-
JSON.parse(JSON.stringify(obj))
-
structuredClone(obj)
-
_.cloneDeep(num)
-
JSON.parse(JSON.stringify(num))
-
structuredClone(num)