Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Stringify vs. cloneDeep vs. structuredClone
(version: 4)
Comparing performance of:
JSON parse and stringify vs lodash cloneDeep vs structuredClone()
Created:
2 years ago
by:
Registered User
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 matrixData = { horizontalAxisData: [ // Employees { id: 'eb2cabbd-c1ca-47f9-a7d7-817d0a51a7a6', label: 'Group A0', elements: [{ id: '7f4f8a1d-6efe-4808-8856-f534c4728536', label: 'Group A1', elements: [{ id: '5a644109-31db-4d2c-b632-c8643c775b82', label: 'Group A2', elements: [{ id: 'bc3a57b2-a731-46ba-81aa-8e47c3ec844c', label: 'Amelia Miller', }, { id: '5d2e8807-3615-4c3c-b724-e62587951049', label: 'Harper Wilson', }, { id: 'e9d15dbd-ff4c-4552-8318-d9a4b7e59c63', label: 'Elijah Smith', }, { id: 'bf590ec9-8a64-4416-bd8b-ab7598c9d440', label: 'Amelia Wilson', }, { id: 'cb0a47c0-6f1e-41d6-91a2-d263f6d1e332', label: 'Noah Anderson', }, ], }, { id: '023e771c-366b-4af1-bbf8-69877765e93e', label: 'Millie Abbott', }, { id: '02ff5c23-b51e-4304-839c-c140296a27bf', label: 'Oliver Brown', }, { id: 'd1b34337-cdbb-4c83-84ae-6a1a526481bb', label: 'Sophia Clark', }, ], }, { id: 'ab328408-13e8-49f2-8669-b5e52a08de54', label: 'Liam Davis', }, { id: '7577c07e-846f-4272-82d1-f23a4ce6d329', label: 'Ava Evans', }, { id: '03c6344e-be96-4ba3-b528-b202f382968a', label: 'Lucas Foster', }, { id: '569a77ec-cf2c-493d-97f1-c4afb113a351', label: 'Isabella Green', }, ], }, { id: '3fe86ed1-c6b9-4ba2-bafe-c6fa0af89ecd', label: 'Group B0', elements: [{ id: 'b37f6abd-d6ca-469b-bc1a-9c2b1a5b3350', label: 'Amelia Taylor', }, { id: '699b5746-530b-4307-a777-676a12189bdb', label: 'Henry Miller', }, { id: '5640f09a-b605-4b68-8c34-793f600cfae7', label: 'Mia Thomas', }, { id: 'ba632589-d7f3-4927-a66b-8517c349b0a0', label: 'Harper Martin', }, { id: '7789c32f-db8d-423d-9ca1-f66249743631', label: 'Isabella Davis', }, ], }, ], verticalAxisData: [ // Skills { id: '9c85b9e8-2541-447e-adcf-d566f6c8ea18', label: 'Bakery', elements: [{ id: '2e1efadb-a42f-447e-adcf-b5b07ef3a487', label: 'Bread Baking', }, { id: '2daec260-c0ca-4f36-9e4d-7584b1847199', label: 'Pastry Making', }, { id: 'b948c292-2ccf-4787-ab14-33793fba7808', label: 'Dough Preparation', }, { id: 'e174b8b2-2541-4e61-b6bb-5f5555afec50', label: 'Mixing Ingredients', }, { id: 'fc7628bb-0e45-40f0-9f70-4159d621ffe0', label: 'Baking Techniques', }, { id: 'fd4047e8-03ec-4683-941c-6cd1692613d3', label: 'Yeast Handling', }, ], }, { id: 'abc5b9e8-2541-447e-adcf-d566f6c8ea18', label: 'Bakery Management', elements: [{ id: 'e2cf91ef-6a7f-4879-8eac-23c658a2a271', label: 'Inventory Management', }, { id: '9c85b9e8-01ab-4e51-b253-43c01399cb52', label: 'Business Strategy', }, { id: '6146f16d-74e3-4205-aed6-d566f6c8e987', label: 'Customer Relations', }, { id: '14b39f1a-4b72-4bad-9057-56b9d589eefb', label: 'Quality Assurance', }, ], }, ], skillsData: [{ id: 'bc3a57b2-a731-46ba-81aa-8e47c3ec844c', skills: [ { id: '2e1efadb-a42f-447e-adcf-b5b07ef3a487' }, { id: '2daec260-c0ca-4f36-9e4d-7584b1847199' }, { id: 'e174b8b2-2541-4e61-b6bb-5f5555afec50' }, { id: '6146f16d-74e3-4205-aed6-d566f6c8e987' }, ], }, { id: '023e771c-366b-4af1-bbf8-69877765e93e', skills: [{ id: '2e1efadb-a42f-447e-adcf-b5b07ef3a487' }, { id: '2daec260-c0ca-4f36-9e4d-7584b1847199' }, { id: 'e174b8b2-2541-4e61-b6bb-5f5555afec50' }, { id: '6146f16d-74e3-4205-aed6-d566f6c8e987' }, ], }, ], };
Tests:
JSON parse and stringify
const jsonParseStringify = JSON.parse(JSON.stringify(matrixData));
lodash cloneDeep
const lodashCloneDeep = _.cloneDeep(matrixData);
structuredClone()
const clone = structuredClone(matrixData);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
JSON parse and stringify
lodash cloneDeep
structuredClone()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser/OS:
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
JSON parse and stringify
127672.8 Ops/sec
lodash cloneDeep
68978.0 Ops/sec
structuredClone()
72816.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Based on the provided data, it appears to be related to benchmarking and testing of different JavaScript libraries for JSON parsing and cloning. To answer your question, I would need more context or specific information about what you are asking me to do. However, I can provide some general insights based on the provided data: 1. The `matrixData` object seems to contain nested structures with arrays and objects. 2. The benchmark definitions mention using various libraries for JSON parsing and cloning: * `JSON.parse(JSON.stringify(matrixData))`: Uses the built-in JavaScript `JSON` library for parsing and stringification. * `_ = require('lodash'); const lodashCloneDeep = _.cloneDeep(matrixData);`: Uses the Lodash library for deep cloning of the object. * `const clone = structuredClone(matrixData);`: Uses the Web APIs (W3C) `structuredClone()` function for creating a deep clone of the object. 3. The latest benchmark results show different execution frequencies per second for each test case, indicating varying performance of the libraries being tested. If you could provide more context or specific questions about this data, I'd be happy to help!
Related benchmarks:
Lodash cloneDeep vs native cloneDeep vs structuredClone
Lodash cloneDeep vs custom cloneDeep vs structuredClone
Lodash cloneDeep vs JSON Clone vs Ramda Clone for big Array
Lodash cloneDeep vs native cloneDeep vs native structuredClone
Comments
Confirm delete:
Do you really want to delete benchmark?