Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object cloning with Lodash clone vs cloneDeep vs merge vs ES6 object spread vs ES6 Object.assign vs Clones
(version: 0)
Comparing performance of:
Lodash cloneDeep vs Clone vs JSON
Created:
5 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 src='https://unpkg.com/clone@2.1.2/clone.js'></script>
Script Preparation code:
var o = [ "learn", { "dress": 1821412594.7323036, "under": "blow", "ill": "whom", "which": 871377124, "remain": 852192996, "nervous": { "plus": { "rapidly": { "hungry": 2043837673.0826406, "community": [ true, { "blood": false, "pile": 1680352015, "globe": true, "pond": "meal", "office": { "chair": [ [ 985130904, [ 1372766842, -182309011.24523544, false, 1919128487.9936833, { "should": -1760505577, "whenever": 44143351, "opportunity": -1527261010.2500224, "contain": "port", "command": "strike", "chamber": -200598023, "hunter": false, "native": 954675668, "expect": false, "pure": true, "tales": "review", "planet": true, "suit": false, "poem": true, "found": 1822687153.1425934, "cannot": false, "thousand": true, "careful": -877957471, "explanation": -451580889.3371177, "week": false, "shown": true, "green": -1007512057.8491521, "gift": "wealth", "unit": -1826729933, "gently": false, "old": "additional", "environment": false, "hearing": false, "eight": false, "vegetable": "rather", "stone": "sometime", "girl": 1047335808, "universe": 1711354314.7525005, "wood": false, "fuel": -914679559 }, -868052465.4188604, false, -512944376.6317477, "being", 1407219389.026486, false, "writer", true, -638141337.3608594, "those", "golden", false, 1905785469, -1168126505.0412383, -829438811, "plates", true, 1471508699.8842173, "creature", false, false, false, -1688082037.4808621, "below", 1867398569.208486, false, true, "play", "friend", 937037787 ], "worker", true, false, "scientist", 404217088.1949835, "far", 636719690.1276512, 1796570274.1635828, "nice", 2000039337.0220752, 1156500456.5153146, -1200027385, "nobody", "past", -1926205052.8609881, "must", true, -905314540.1914072, true, true, true, "pitch", "paint", "rose", true, 1812721532, -942771214, "particular", -289030345.1428819, "coach", "newspaper", "through", false ], "carefully", true, -1338006064.0432043, true, "year", "usually", false, "trade", "area", "congress", 2103602221, false, "vapor", "recognize", true, -1636577026.3519006, -1917702941, false, -1414575142.5087962, "tears", "if", false, -527484220, "statement", true, 2090956442.1008801, "traffic", false, "here", -1179317328.2709417, -1838716430.092338, "forth", -636054840, "future" ], "remarkable": true, "pictured": "shape", "corner": false, "baby": -2088696875.1224546, "best": -277259688.8115597, "combine": "party", "teach": true, "occur": 650715061, "buried": 1130731175.8877544, "center": false, "evening": "successful", "birthday": -807136181.6205964, "early": "nearer", "fifty": 1366005568, "bent": 1478699222.315825, "sleep": true, "burst": true, "word": 151878425.55890322, "sets": false, "vast": true, "story": "globe", "operation": false, "solar": "driving", "well": -1853695048.2815156, "five": "question", "fear": false, "strength": "hidden", "cold": -875544381, "mistake": "enjoy", "taste": false, "major": true, "no": true, "warm": "forgot", "purple": 1756563844.1442847 }, "clothing": true, "particular": -1251735443, "floating": 1024060904, "without": -1486307239, "acres": true, "strip": false, "driven": true, "birds": "win", "shoulder": 130726564, "win": 200390378, "farther": -456407228.1025076, "may": false, "valuable": 53617975.1128335, "girl": "good", "adjective": -780867927, "throw": true, "police": true, "birthday": "exact", "nearer": false, "along": false, "fort": 588281762, "society": -493778098.98820734, "city": "old", "top": -997444596.0223145, "border": "gain", "held": -1510401167, "string": -855769999.5335917, "stay": "smoke", "four": false }, 1274912987.5524063, 1656388049.621934, "ship", -1108283577, "make", "indicate", "progress", -1654313944, "broke", true, true, "us", -324212481, true, -1951272032.0974512, "lucky", true, 1419919919, -1494018722, "neighbor", "concerned", "perfect", -50406787.596048355, false, -1426070886.2557898, "minerals", 750626194, "favorite", "determine", true, -2009016173.640308, "hit", "depend" ], "or": "dried", "studied": "said", "curious": true, "stairs": "gave", "mountain": "pound", "symbol": false, "sets": "pale", "was": 196179931, "older": false, "our": "ride", "private": "person", "except": "parallel", "tell": 1159561185.9620914, "sink": -548095969.3881321, "struggle": -723034353.1341114, "behind": -2090634492, "wide": true, "slope": "sudden", "already": "alive", "trail": 48490709, "forget": 717196193, "function": 798688629.6542072, "cross": "nodded", "copy": true, "outline": true, "statement": false, "young": 1042946436, "wet": "wrote", "magic": false, "shut": "contain", "salt": true, "there": "space", "yourself": "tin" }, "push": "lips", "tea": -556075697.4512801, "damage": "rather", "consider": true, "fly": false, "opinion": "scale", "till": "accurate", "leg": "religious", "possibly": false, "sharp": "shaking", "needed": -783229367.6865501, "pot": -1014785329, "day": "live", "church": "balance", "stop": "change", "truck": "cave", "interior": 1989049441, "keep": "pay", "public": -740715398.7494001, "fight": -1967264955, "entire": 2007448735.9446745, "service": "rhythm", "coming": -1258355659, "laid": true, "was": "but", "horn": true, "smoke": true, "hat": -1323140570, "give": true, "key": -546081305, "spin": -1134528993, "green": "hair", "saved": "his" }, "morning": "receive", "sight": false, "movement": -312028627.3611965, "natural": true, "bear": -214371857, "will": 2098024514, "accept": -1719030478, "provide": 1890850575, "building": 242589169, "grown": true, "universe": "clear", "thought": "week", "willing": 136536661.3928299, "closer": "labor", "silly": 1085755364.3624377, "bigger": 24480609.100919724, "horse": "melted", "deer": false, "master": "honor", "love": -1474560564.523521, "few": 761427764.1331215, "born": true, "such": "agree", "activity": 738071352.7612228, "rich": "material", "examine": "touch", "national": true, "fell": "been", "free": false, "however": "means", "driver": 733623707, "whose": -500068812.078557, "speak": false, "favorite": "needle" }, "everything": 1075009443.237411, "high": 449406206, "wind": false, "screen": false, "let": "pine", "suddenly": 628485017, "usually": "expect", "standard": "red", "lay": "suggest", "end": false, "work": true, "rapidly": "who", "else": "read", "duty": false, "brief": "make", "news": -1927103217, "factory": true, "chose": -1063028746, "indeed": "settle", "task": "cover", "wing": false, "either": false, "date": "poetry", "treated": true, "belt": 300970914, "measure": 1752382036, "upper": "plane", "raise": -786594026.1031046, "supply": true }, false, "well", -361269000, 1786575437, 349094587, false, 1761068067, -1428989746.4246798, "although", "sea", false, "having", -1027240257.3023381, "farther", false, 556135078, false, "blue", false, -116910777.86578465, "discuss", true, "basic", "face", "changing", false, "till", "declared", 1091192008.434588, -178019274.8340044, "history", true, 1368272893.778099 ]
Tests:
Lodash cloneDeep
const a = _.cloneDeep(o)
Clone
const a = clone(o)
JSON
const a = JSON.parse(JSON.stringify(o))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lodash cloneDeep
Clone
JSON
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):
I'll provide an answer based on the provided data. Based on the latest benchmark result, it appears that: 1. The `Clone` test is the fastest, with an execution rate of 14868.9189453125 executions per second. 2. The `Lodash cloneDeep` test is slightly slower, with an execution rate of 12838.9775390625 executions per second. 3. The `JSON` test is the slowest, with an execution rate of 10852.955859375 executions per second. However, I notice that there is no data on which implementation (Lodash's `cloneDeep` or a custom `clone` function) is actually faster in practice. To determine this, additional testing and analysis would be needed to compare the performance of each implementation under different conditions. Additionally, it seems like the benchmarking tool output is in JSON format, but it appears to be incomplete. The full dataset is not provided, so I couldn't analyze the entire set of results.
Related benchmarks:
Object cloning with Lodash clone vs cloneDeep vs merge vs ES6 object spread vs ES6 Object.assign
Object cloning with Lodash clone vs cloneDeep vs merge vs ES6 object spread vs ES6 Object.assign vs JSON.parse(JSON.stringify())
Object cloning with Lodash cloneDeep vs ES6 object spread vs JSON.stringify
Object cloning with Lodash clone vs cloneDeep vs merge vs ES6 object spread vs ES6 Object.assign VS JSON.parse
Object cloning with Lodash clone vs cloneDeep vs merge vs ES6 object spread vs ES6 Object.assign vs structuredClone
Comments
Confirm delete:
Do you really want to delete benchmark?