Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash cloneDeep vs JSON Clone (BBJson)
(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 = {"widget":"Base","id":"base-block","web":{"domClasses":[],"pseudoStyles":[],"domId":"pendo-base","layout":"lightboxBlank","editingId":"375b7e4d-a72f-4f06-9860-f325e2acbd99"},"actions":[],"properties":[],"templateName":null,"views":[{"widget":"LinearLayout","id":"insert_visual_floating_layout","web":{"domClasses":[],"pseudoStyles":[],"domId":"pendo-backdrop","editingId":"15b71ef0-4556-4352-b024-2262adabf0b9"},"actions":[],"properties":[{"name":"z-index","type":"string","value":"200000"},{"name":"background","type":"color","value":"#FFFFFFBF"},{"name":"layout_height","type":"dimen","value":"match_parent"},{"name":"opacity","type":"string","value":"1"},{"name":"layout_width","type":"dimen","value":"match_parent"},{"name":"enabled","type":"boolean","value":true}],"templateName":null,"views":[],"layoutId":null,"uiMetadata":{"name":"","wizard":{"defaultValues":{},"defaultActions":{}}}},{"widget":"LinearLayout","id":"insert_visual_main_layout","web":{"domClasses":[],"pseudoStyles":[{"selector":"div[tabindex=-1]:focus","styles":{"outline":"none"}}],"domId":"pendo-g-6UyZtOXd_lz8VkUlnBOJc2GyNjU","verticalAlignment":"Centered","editingId":"d1e76518-77d8-46cf-92dc-4dd6b22c0149"},"actions":[],"properties":[{"name":"layout_width","type":"dimen","value":"568dp"},{"name":"layout_gravity","type":"string","value":"center_vertical|center_horizontal"},{"name":"z-index","type":"string","value":"300000"}],"templateName":null,"views":[{"widget":"LinearLayout","id":"insert_visual_container_layout","web":{"domClasses":[],"pseudoStyles":[],"domId":"pendo-guide-container","tabIndex":"-1","caret":{"height":"15px","width":"15px","enabled":false},"editingId":"286bf36a-6faa-49f9-8e43-42baced65e5d","ariaModal":"true"},"actions":[],"properties":[{"name":"background","type":"color","value":"#FFFFFFFF"},{"name":"frameColor","type":"color","value":"#BBBBBB"},{"name":"frameStyle","type":"string","value":"solid"},{"name":"layout_position_type","type":"string","value":"relative"},{"name":"shadowColor","type":"color","value":"#888888FF"},{"name":"shadowOffsetHorizontal","type":"dimen","value":"0dp"},{"name":"shadowOffsetVertical","type":"dimen","value":"0dp"},{"name":"shadowRadius","type":"dimen","value":"22dp"},{"name":"shadowSpread","type":"dimen","value":"0dp"},{"name":"frameWidth","type":"dimen","value":"2dp"},{"name":"frameRadius","type":"dimen","value":"0dp"},{"name":"paddingBottom","type":"dimen","value":"45dp"},{"name":"paddingLeft","type":"dimen","value":"45dp"},{"name":"paddingRight","type":"dimen","value":"45dp"},{"name":"paddingTop","type":"dimen","value":"45dp"}],"templateName":null,"views":[{"widget":"CloseButton","id":"insert_visual_close_button","web":{"domClasses":[],"pseudoStyles":[{"selector":"#pendo-close-guide-7a52ec47:hover","styles":{"color":"#999999FF"}},{"selector":"#pendo-close-guide-7a52ec47:focus","styles":{"outline":"none"}}],"domId":"pendo-close-guide-7a52ec47","ariaLabel":"Close","editingId":"a4785ccb-a806-41b9-b2c6-e02d99a74d67"},"actions":[{"action":"dismissGuide","source":"insert_visual_close_button","destination":"Global","parameters":[],"uiMetadata":{},"eventType":"click"}],"properties":[{"name":"frameWidth","type":"dimen","value":"0dp"},{"name":"textLineHeight","type":"dimen","value":1},{"name":"layout_margin","type":"dimen","value":"0dp"},{"name":"paddingBottom","type":"dimen","value":"0dp"},{"name":"paddingLeft","type":"dimen","value":"0dp"},{"name":"paddingRight","type":"dimen","value":"0dp"},{"name":"paddingTop","type":"dimen","value":"0dp"},{"name":"text","type":"string","value":"×"},{"name":"z-index","type":"string","value":"20"},{"name":"layout_minWidth","type":"dimen","value":"0dp"},{"name":"fontFamily","type":"string","value":"Helvetica"},{"name":"textStyle","type":"dimen","value":100},{"name":"background","type":"string","value":"none"},{"name":"frameRadius","type":"dimen","value":"0dp"},{"name":"textSize","type":"dimen","value":"36dp"},{"name":"layout_position_type","type":"string","value":"absolute"},{"name":"layoutAbsolute_left","type":"dimen","value":"auto"},{"name":"layoutAbsolute_right","type":"dimen","value":"17dp"},{"name":"layoutAbsolute_top","type":"dimen","value":"6dp"},{"name":"xColor","type":"color","value":"#CCCCCCFF"},{"name":"xWidth","type":"dimen","value":"39dp"},{"name":"enabled","type":"boolean","value":true}],"templateName":null,"views":[],"layoutId":null,"uiMetadata":{"name":"","wizard":{"defaultValues":{},"defaultActions":{}}}}],"layoutId":null,"uiMetadata":{"name":"","wizard":{"defaultValues":{},"defaultActions":{}}}}],"layoutId":null,"uiMetadata":{"name":"","wizard":{"defaultValues":{},"defaultActions":{}}}}],"layoutId":null,"uiMetadata":{"name":"","wizard":{"defaultValues":{},"defaultActions":{}}},"theme":{"supplementalCss":{"_pendo-step-container-size":{},"_pendo-backdrop":{},"_pendo-step-container-styles":{},"_pendo-close-guide":{}}}}; 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):
It seems like you've provided a large JSON object, but I'll assume it's the result of a benchmarking test. To provide an answer, I need to parse the `Html Preparation Code` section and identify any JavaScript operations performed on the `myCopy` variable. Then, I can analyze the `Individual test cases` section to determine which clone method is being tested. Here's my analysis: 1. **Html Preparation Code**: This code includes a script tag that loads Lodash.js library version 4.17.5. Additionally, it imports the `lodash.min.js` file. 2. **Individual test cases**: * The first test case uses the `_cloneDeep` method from Lodash to create a deep copy of an object named `MyObject`. * The second test case uses the `JSON.parse(JSON.stringify(MyObject))` method to create a shallow copy of the same object. 3. **Latest benchmark result**: This section shows the execution rates for each test case, with "Json clone" having a higher execution rate than "Lodash cloneDeep". Based on this analysis, I can infer that the `JSON.parse(JSON.stringify(MyObject))` method is faster than using Lodash's `_cloneDeep` method. However, please note that this result may not be representative of all situations, as the performance difference between these two methods can depend on various factors, such as the size and complexity of the object being cloned. To answer your question, I'll take a deep breath... The `JSON.parse(JSON.stringify(MyObject))` method is slightly faster than Lodash's `_cloneDeep` method.
Related benchmarks:
Lodash deep clone vs JSON.stringfy
Lodash deep clone vs Spread Clone
Lodash cloneDeep vs JSON Clone with Array
Fair Lodash deep clone vs Spread Clone
Comments
Confirm delete:
Do you really want to delete benchmark?