Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash cloneDeep vs JSON Clone 2222
(version: 0)
Comparing performance of:
Lodash cloneDeep vs Json clone
Created:
6 years 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 = { '27abdbf4-f6b8-11e7-99e8-49ff5466525e': { attributes: { ArticleCode: { ToSaveDataTo: '12' }, Brand: { AmazonAPI: { en: 'Epson' } }, Category1: { AmazonAPI: { en: 'CE' }, TechData: { en: 'Supplies' }, ToSaveDataTo: { en: 'CE2' } }, Category2: { AmazonAPI: { en: 'Electronics' }, TechData: { en: 'Paper - Printers' } }, Category3: { TechData: { en: 'Office Paper & Film' } }, Description: { TechData: { en: 'Paper/Photo Quality A3+102gm2 100sh' } }, EAN: '0010343812048', Label: { AmazonAPI: { en: 'Epson' } }, Manufacturer: { AmazonAPI: { en: 'Epson' }, TechData: { en: 'Epson' } }, ModelNumber: { ToSaveDataTo: '11' }, MPN: { AmazonAPI: 'C13S041069' }, Price: { TechData: '36,15' }, Title: { AmazonAPI: { en: 'Epson A3+ Photo Quality Inkjet Paper 100 Sheets - White' }, ToSaveDataTo: { nl: 'product' } }, VendorPartNumber: 'C13S041069' }, createdAt: '2018-01-11T10:14:05+00:00', updatedAt: '2019-05-17T09:52:25+00:00', status: null, vendorPartNumber: 'C13S041069', eanCode: '0010343812048', id: '27abdbf4-f6b8-11e7-99e8-49ff5466525e', categories: [ '00dde55c-6db9-11e9-8963-eff82f36df03', '01909508-6db9-11e9-9355-e74c0d58763b' ], favourite: false }, '2e0d0714-06a0-11e8-84e4-f5036771bf95': { attributes: { Brand: { AmazonAPI: { en: 'LEGO UK' }, WaveData: { nl: 'LEGO' } }, Category1: { AmazonAPI: { en: 'Toy' }, WaveData: { nl: 'Speelgoed' } }, Category2: { AmazonAPI: { en: 'Toy' } }, Category3: { WaveData: { nl: '1SSLKW0P' } }, Cost: { WaveData: { nl: '24,79' } }, DeepLearning: { AKAdmin_personal: { en: '12345\n' }, ToSaveDataTo: { nl: 'illustratie, plezier, volk, vrouw, mannelijk, sport, symbool, afbeelding, teken, rondje, wereldwijd web, design (decoratie), internet, vector (rechte lijn), communicatie, bedrijfsleven, controleren, element, verbod, geïsoleerd, verboden, reeks, contact (communicatie)' } }, DetailedURL: { AmazonAPI: 'https://www.amazon.co.uk/LEGO-41597-Brick-Headz-Building/dp/B075T2P9JS' }, Dimensions: { AmazonHTML: '262 x 95 x 222 cm' }, EAN: '5702016072624', ImageUrl: { AmazonAPI: 'https://images-eu.ssl-images-amazon.com/images/I/61nngvH9eCL.jpg', WaveData: 'https://www.wave-distributie.nl/pix/product/missingProdpic/noPic230x230.png' }, ImageUrl2: { ToSaveDataTo: { nl: 'https://www.amazon.co.uk/LEGO-41597-Brick-Headz-Building/dp/B075T2P9JS' } }, ItemWeight: { AmazonHTML: '658 g', WaveData: '500 gram' }, Label: { AmazonAPI: { en: 'LEGO' }, WaveData: { nl: 'Brick Headz Brick me' } }, Manufacturer: { AmazonAPI: { en: 'LEGO' } }, ModelNumber: { AmazonAPI: '41597', AmazonHTML: '41597' }, MPN: { AmazonAPI: '41597' }, Price: { AmazonHTML: '£24.80', WaveData: '24,79' }, Quantity: { AKAdmin_personal: '122' }, SourceOwnID: { AmazonHTML: 'B075T2P9JS', WaveData: '1SSLKW0P' }, Title: { AmazonAPI: { en: 'LEGO 41597 Brick Headz Go Brick Me Building Set' } }, VendorPartNumber: '41597' }, createdAt: '2018-01-31T16:02:47+00:00', updatedAt: '2019-05-19T20:19:33+00:00', status: null, vendorPartNumber: '41597', eanCode: '5702016072624', id: '2e0d0714-06a0-11e8-84e4-f5036771bf95', categories: [ '00dde55c-6db9-11e9-8963-eff82f36df03', '026e984e-6db9-11e9-97cb-1739d4799a53', '028cd98a-6db9-11e9-bf68-11f5ff0b8ac8', '07ed63d6-6db9-11e9-a244-d92c0f02915d' ], favourite: false }, '9e607788-207d-11e9-bd0e-b1bad9e0b610': { attributes: { Category1: { Lekkerland: { en: 'Katja', fr: 'Katja', nl: 'Katja' } }, DeepLearning: { ToSaveDataTo: { nl: 'trein, spoorweglijn), vervoer, reizen, station, weg, voertuig, motor, openbaar, verkeer, buis (spoorweg), geen persoon, racebaan, platform, forens, auto, buitenshuis, snel, daglicht' } }, Description: { Lekkerland: { en: 'AARDBEISTICKS GEVULD ', fr: 'AARDBEISTICKS GEVULD ', nl: 'AARDBEISTICKS GEVULD ' } }, EAN: '8716100331648', ImageUrl: { ToSaveDataTo: 'https://cdn.londonandpartners.com/visit/london-organisations/transport-system/59590-640x360-overground-train_640.jpg' }, SKU: { Lekkerland: '111945' }, Title: { Lekkerland: { en: 'KATJA FASSIN B.V. ', fr: 'KATJA FASSIN B.V. ', nl: 'KATJA FASSIN B.V. ' } }, Weight: { Lekkerland: { en: '1.615', fr: '1.615', nl: '1.615' } } }, createdAt: '2019-01-25T08:45:51+00:00', updatedAt: '2019-05-16T09:54:46+00:00', status: null, vendorPartNumber: '8716100331648', eanCode: '8716100331648', id: '9e607788-207d-11e9-bd0e-b1bad9e0b610', categories: [ '00dde55c-6db9-11e9-8963-eff82f36df03' ], favourite: false } }; var myCopy = null;
Tests:
Lodash cloneDeep
myCopy = _.cloneDeep(MyObject);
Json clone
myCopy = JSON.parse(JSON.stringify(MyObject));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash cloneDeep
Json clone
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
A very specific test case! After analyzing the provided data, I'll attempt to answer your question: **What is the difference in performance between using `_.cloneDeep` (Lodash) and `JSON.parse(JSON.stringify)` for cloning an object?** Based on the latest benchmark result, which shows the average execution time per second for each test case, it appears that: * `JSON.parse(JSON.stringify)` performs slightly faster than `_.cloneDeep`. * However, the difference is relatively small (about 12.5% slower with Lodash). * The execution times are influenced by various factors, including the complexity of the object being cloned and the specific hardware/software configuration. Keep in mind that this analysis is based on a single benchmark result and may not be representative of all scenarios or environments. Additionally, while performance is an important consideration, other factors like code readability, maintainability, and memory usage should also be taken into account when choosing between these two cloning methods. If you'd like to explore further, I can help with: * Providing more detailed analysis of the benchmark results * Offering suggestions for improving performance or code quality * Discussing trade-offs between `_.cloneDeep` and `JSON.parse(JSON.stringify)` * Or answering any other specific questions related to this test case
Related benchmarks:
Lodash benchmark (Anton)
Lodash cloneDeep vs JSON Clone with Array
cloneDeep vs JSON stringify + parse (long arr)
lodash cloneDeep vs json.stringify
Lodash cloneDeep vs JSON parse
Comments
Confirm delete:
Do you really want to delete benchmark?