structuredClose(myObject) vs JSON.parse(JSON.stringify(myObject)) (version: 0)
Both structuredClone(myObject) and JSON.parse(JSON.stringify(myObject)) can be used to create deep copies of JavaScript objects, but which is faster for a decent sized object?
Comparing performance of: structuredClone(myObject) vs JSON.parse(JSON.stringify(myObject))
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory
Test case name
Result
structuredClone(myObject)
JSON.parse(JSON.stringify(myObject))
Fastest:N/A
Slowest:N/A
Latest run results:
Run details: (Test run date:
2 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0