Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array of object destruc vs JSON.parse + JSON.stringify
Checking how does 1 level of objects destruct inside 1 array compared to the JSON.parse(JSON.stringify(data)) hack commonly used to deeply nested objects
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
1 level destruct
4841680.0 Ops/sec
Json parse
691764.2 Ops/sec
Tests:
1 level destruct
const original = new Array(10).fill(null).map((_, i) => ({a:i, b:2*i, c: 'hi'})) const des = original.map((item) => ({...item})) des[0].a;
Json parse
const original = new Array(10).fill(null).map((_, i) => ({a:i, b:2*i, c: 'hi'})) const json = JSON.parse(JSON.stringify(original)); json[0].a;