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
ⓘGet performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date:
4 days ago)
Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0