Test case name | Result |
---|---|
_.cloneDeep(obj) | |
JSON.parse(JSON.stringify(obj)) | |
structuredClone(obj) | |
_.cloneDeep(num) | |
JSON.parse(JSON.stringify(num)) | |
structuredClone(num) |
Test name | Executions per second |
---|---|
_.cloneDeep(obj) | 36246.2 Ops/sec |
JSON.parse(JSON.stringify(obj)) | 41950.3 Ops/sec |
structuredClone(obj) | 42641.9 Ops/sec |
_.cloneDeep(num) | 879510.9 Ops/sec |
JSON.parse(JSON.stringify(num)) | 413144.2 Ops/sec |
structuredClone(num) | 141847.8 Ops/sec |