Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JSON parse vs structuredClone | longer json
(version: 0)
Test json
Comparing performance of:
JSON parse vs Native structuredClone
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var MyObject = { "person1": { "name": "Alice", "age": 30, "address": { "street": "123 Maple St", "city": "Wonderland", "zip": "12345" }, "hobbies": ["reading", "chess", "hiking"] }, "person2": { "name": "Bob", "age": 28, "address": { "street": "456 Oak St", "city": "Mystic Falls", "zip": "67890" }, "hobbies": ["gaming", "cycling", "cooking"] }, "person3": { "name": "Charlie", "age": 35, "address": { "street": "789 Pine St", "city": "Haven", "zip": "13579" }, "hobbies": ["painting", "running", "swimming"] }, "company1": { "name": "TechCorp", "location": { "city": "Silicon Valley", "state": "CA" }, "employees": [ { "name": "David", "role": "Engineer", "experience": 5 }, { "name": "Eva", "role": "Designer", "experience": 3 }, { "name": "Frank", "role": "Product Manager", "experience": 7 } ] }, "company2": { "name": "DesignCo", "location": { "city": "New York", "state": "NY" }, "employees": [ { "name": "Grace", "role": "Architect", "experience": 6 }, { "name": "Henry", "role": "Graphic Designer", "experience": 4 }, { "name": "Isabel", "role": "UX Specialist", "experience": 5 } ] }, "company3": { "name": "BuildIt", "location": { "city": "Chicago", "state": "IL" }, "employees": [ { "name": "Jack", "role": "Civil Engineer", "experience": 8 }, { "name": "Kara", "role": "Project Manager", "experience": 9 }, { "name": "Liam", "role": "Construction Worker", "experience": 2 } ] }, "product1": { "name": "Laptop", "category": "Electronics", "specs": { "processor": "Intel i7", "memory": "16GB", "storage": "512GB SSD" }, "price": 1200 }, "product2": { "name": "Smartphone", "category": "Electronics", "specs": { "processor": "Snapdragon 888", "memory": "8GB", "storage": "256GB" }, "price": 800 }, "product3": { "name": "Tablet", "category": "Electronics", "specs": { "processor": "Apple M1", "memory": "8GB", "storage": "128GB" }, "price": 600 }, "project1": { "title": "Project Alpha", "deadline": "2024-12-31", "team": { "leader": "Michael", "members": ["Natalie", "Oscar", "Peter"] }, "status": "In Progress" }, "project2": { "title": "Project Beta", "deadline": "2024-06-30", "team": { "leader": "Quincy", "members": ["Rachel", "Steven", "Tracy"] }, "status": "Completed" }, "project3": { "title": "Project Gamma", "deadline": "2025-03-15", "team": { "leader": "Uma", "members": ["Victor", "Wendy", "Xander"] }, "status": "Not Started" }, "event1": { "name": "Conference 2024", "date": "2024-11-20", "location": { "venue": "Convention Center", "city": "Las Vegas", "state": "NV" }, "attendees": 500 }, "event2": { "name": "Workshop on AI", "date": "2024-08-15", "location": { "venue": "Tech Park", "city": "San Francisco", "state": "CA" }, "attendees": 200 }, "event3": { "name": "Web Development Bootcamp", "date": "2024-07-10", "location": { "venue": "Innovation Hub", "city": "Austin", "state": "TX" }, "attendees": 150 } } var myCopy = null;
Tests:
JSON parse
myCopy = JSON.parse(JSON.stringify(MyObject));
Native structuredClone
myCopy = structuredClone(MyObject);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
JSON parse
Native structuredClone
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Browser/OS:
Chrome 126 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
JSON parse
76651.7 Ops/sec
Native structuredClone
45976.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It looks like you have a large JSON object representing data for various products, projects, and events, along with benchmarking information. To answer your question, I'll focus on the `JSON parse` and `Native structuredClone` test cases. For `JSON parse`, we can analyze the code: `"myCopy = JSON.parse(JSON.stringify(MyObject));"`. This code creates a deep copy of the original object using `structuredClone` (not available in older browsers) or `JSON.parse(JSON.stringify())`. However, since `structuredClone` is not supported in older browsers, I'll assume the benchmark results are for modern browsers that support it. In this case, the execution time for `JSON parse` would be lower due to the performance benefits of `structuredClone`. But without more specific data on browser versions and hardware, it's difficult to provide a precise answer. As for `Native structuredClone`, since it's not supported in older browsers, I'll assume the benchmark results are for modern browsers that support it. In this case, the execution time should be lower compared to using `JSON.parse(JSON.stringify())` due to its performance benefits. To give you a more specific answer, could you please provide: 1. Browser versions (e.g., Chrome 126)? 2. Hardware specifications (e.g., Intel Core i9, NVIDIA GeForce RTX 3080)? 3. Execution times for both `JSON parse` and `Native structuredClone` in the benchmark results? With this information, I can provide a more detailed analysis and answer your question.
Related benchmarks:
Lodash.isEqual vs JSON.stringify Equality Comparison for Large Deep Object.
Lodash cloneDeep vs structuredClone vs recursiveDeepCopy vs JSON clone more complex object
JSON.stringify vs structuredClone (7 KB JSON)
structuredClose(myObject) vs JSON.parse(JSON.stringify(myObject))
Comments
Confirm delete:
Do you really want to delete benchmark?