Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
CloningBenchmark01
(version: 0)
Comparing performance of:
lodash cloneDeep vs structuredClone vs JSON.parse JSON.stringify
Created:
3 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 str = '{"sunlight":"image","indicate":{"wrote":false,"active":[-152187934,[true,{"bear":1002092498,"suggest":[false,{"as":false,"come":true,"rubber":["determine","thumb",{"turn":-471398763,"flow":678423324.942977,"seldom":-1644836127.69942,"sunlight":[false,[[633990166.5341525,[-2090917560,true,false,[{"famous":false,"edge":["prize","repeat",true,"class",118383196.64016724,"outer",[-1524321031.218454,-1120325962.6785283,true,[966569032.8563833,-1123424305.247377,{"bad":-1174751582.4474835,"song":2140002956.777709,"consider":"discover","shake":2009507119,"case":{"night":true,"terrible":[-108858632,-1762130753.3415704,4622927.306657791,{"provide":1850429123.773878,"morning":-1340383950,"laid":"guard","fear":[-1097473282.526688,{"doctor":{"movie":"cannot","process":["spoken",-194127356.5017085,{"properly":1380406301,"can":true,"plan":[[false,{"able":-638085336.6696911,"dirt":[true,false,[981463369.8551955,"remove",-366747882.207953,[false,"explain",[-1674083314,["package",607734591.8181343,1172918479.3802261,"mix",-1018793963.377275,"freedom","independent",[{"mine":267082707,"whistle":"rubber","wood":{"daughter":-1909726713,"noise":-1581060154.2421803,"mouse":349534626,"was":[{"ants":"me","boy":true,"motion":"very","powder":-41386006,"brain":"actual","hot":"truck","shells":true,"thought":-129379590,"work":-2120137390,"another":true,"lonely":false,"paid":974893264,"fence":"limited","sent":true,"duty":-502077421.85738564,"form":-1871743227,"oxygen":"suppose","down":"scientific","somewhere":true,"beautiful":"thus"},"feature",true,"horse","chosen",-395744540,false,true,"vowel",170980106.61699724,true,true,false,1785024328,-1730379357.8296642,331448868.2734661,"guess",false,"tears","school"],"plain":272158196,"could":"mad","shirt":270662696.9611759,"college":"accident","elephant":true,"means":745177730,"trap":"fine","standard":false,"mental":"may","nice":"tall","bag":-302457319.21086645,"leaving":false,"stems":"coach","about":"smell","before":-1746393563,"construction":true},"smallest":1663518514,"struggle":false,"birds":1130429341.603859,"cannot":false,"fifth":"shall","observe":false,"brave":-728252500,"that":-9820671.419802666,"fur":"shout","wooden":"bent","team":"glad","progress":"clear","crew":true,"both":-1186637328.5903382,"tired":true,"return":"earn","determine":"biggest"},true,1183784912.8522172,false,"universe",293181856,true,1458941522,"room",1351010392,true,-1327350721,-1437329315,true,"largest",false,"naturally",58412798,false,"went"],"wheel",false,131662305,"friendly",false,"bad","heading",-202737074.85178947,"threw",1970140246,true,"declared"],"log",977640437,"mice","hole",1213634868,"pack",false,143303690.66112375,true,"skin",1242873578.9821267,"religious",false,"passage","however",false,2122256440,false],"smell","off",-90274602,"refused",1171476983.8139014,false,"easier",true,true,"dangerous",true,"police",-1405047932.2784877,false,336157543.9708724,"though","one"],127075874.25836372,"verb",-644382783,"shaking",true,true,-923108383,-1733326365.4323654,true,"younger","swept",false,false,false,true,1444427483.1815953],"above",-1752000436,false,true,"dream",1959773631.287012,1416408988.1202006,-74048076,"tropical",155053599.2792163,false,false,"frame","weigh","mirror",true,-953132773.4525952],"blanket":-561955439,"person":"badly","typical":-1749030608,"in":-28897215.103558064,"kind":true,"shade":"pain","strip":true,"myself":"stranger","changing":1840293250.107294,"pale":"agree","offer":"write","saw":"figure","suggest":388545876.3795967,"ask":806661208.0603123,"angle":false,"earlier":164295231.06215906,"ocean":1174986353,"improve":"refer"},-1518099043.7349205,false,-313894526,-1079634978.3647385,1534875908,false,-820102226,-1676630685,"forty","desert","cry",1222545625.326417,false,2019165261,349616265,true,false,true],"met",1831430077.1862292,"wooden","eventually","record",true,-1301624383.0962315,-599450478,-1110575300.2959213,false,1728155753,true,false,"fence",1059372880.6131077,"cover",false,"beautiful",false],"anyone":-473021675.15050983,"ill":"safe","tie":false,"mind":false,"vapor":"drive","burst":true,"thirty":-1852224907,"do":-1522567903,"being":true,"tank":true,"around":828019505.4164305,"thing":"butter","whom":false,"date":"composition","am":false,"slip":1547590097.979414,"first":false},662274636.8717041,true,true,"here",-1625201029,true,false,"porch","stove","jump",false,"silly","onto",false,true,false,true],"light":-409363055,"had":true,"number":false,"save":"track","hunt":false,"load":-194905444,"blue":"image","birth":-2059285695,"bush":"heading","might":true,"period":false,"bone":2058416666,"voyage":2019149329,"wheel":false,"quarter":"writer","attention":"many","nature":true,"scale":true},"trunk":"twenty","slide":"it","final":false,"soft":false,"rhyme":-314917135,"people":1761421651,"suggest":-10834542,"drawn":"test","troops":"parent","voyage":"test","wire":true,"cave":true,"magic":true,"sell":1582996040,"struggle":-1725295470.4498105,"map":false,"follow":1166996677.8703995,"wet":"gun","cap":true},true,-1391419184.2225428,"student",285488618,-1043107230.9080539,697268550.4956918,true,"action",-533824441.7069702,-1750483619,true,true,"song",843084203,-126181143,"date",false,false],"thick":false,"task":704104607.848876,"knew":false,"daily":"measure","require":1470375187,"manner":true,"bush":true,"longer":"either","slip":"giving","evidence":"again","grabbed":false,"driving":"thy","farmer":-391737003.33611536,"syllable":"if","leg":true,"anyway":1662665640.1952372},false,-1152792553,false,"engineer",2098016362,1592232887.2144852,-1569438046.3315725,true,"somewhere",-1166353892,-1909699501,true,false,"prevent","tropical",1638583058],"due":"hat","eye":true,"muscle":true,"wind":1671327860,"piano":"bottle","structure":"more","organization":true,"enemy":false,"difference":-2054407069,"bright":-316675301.42819166,"star":false,"send":814877326,"check":false,"cross":false,"word":"taught","detail":false,"classroom":-36840744,"surrounded":true},"roof":1227721865.1852102,"branch":false,"large":"climate","completely":"oldest","dark":"case","choose":1689313904,"sometime":true,"shelter":442996173,"collect":false,"describe":-1699274176,"cook":true,"valley":"trip","shore":true,"dress":true,"spring":"just"},true,-2073157700.8204203,"copy","basic",-1543095817.9483595,"book",439006227.09268856,428744225.4321685,true,-803691647,"receive",2041092731,true,true,1832673384,"calm","cutting"],false,1771880552,-1890819300,false,"complex",1358429304,1715932404.429154,true,"iron",1075335186,7850472,"soil",579548754.7971978,false,true,489347798],1271631501.6182847,"naturally",false,"front","white",482005351.6019888,"concerned","treated",false,false,-1997062535,true,true],"title":-865286055.2579889,"bicycle":-395206514,"at":true,"affect":true,"yes":false,"oxygen":1301142407.892168,"teach":"instead","bee":1803238614.3920188,"gone":529177897.3401327,"activity":-2090874961.2678967,"tiny":233957195.22817755,"gasoline":-219670739.7116456,"rays":"whistle","surface":1200214474.0693884,"moon":false,"kill":true,"gas":false,"operation":-1760470249},false,"quick",false,"shall","live",-1281056880.7572703,-1724665802,false,"treated",1262086951,-1348671623,1985098717.3936357,300154855,-1990316935,false,true,"angry",false,false],true,-1083526062,"plane",-1508921280,"needle",true,-1453116494.524981,true,"sweet",-564851789,"own",false,"page",-518712152,"pleasure",false],-990301880.7971449,true,"foot",-1390438114,1086845587.9950256,-94193354.96090698,false,true,-510816620,1242351007.222897,true,"valley","look","heart",false,-585845814,-1527811652.5658855,1858325757.6707406],true,false,727225572,1748505852.0763516,1855381842,"twenty",true,true,1193415329.6887197,true,false,2127536443,-1676930009,559415394.813735,"friend",true,"none",-1721777083,-1961331008.1585321],true,"smallest",-709827102,false,-1253132657.6165686,-1700309492,true,true,false,"home",897783671.0312762,1404805364.5238276,false,"bend","score","hill","rhyme","satellites"],"fat":true,"military":1718069248,"finally":true,"indeed":"palace","social":-58672907,"price":"mission","needle":-310572486.0467377,"verb":true,"recall":815870484.0851192,"valuable":"wagon","impossible":-571592475,"facing":true,"call":false,"leather":"business","mainly":-2062448273,"increase":-299422940.4775338},-1612086704,true,true,"morning",1519362410,true,true,"safety","twelve",-1329275183.7105699,"class",true,false,true,true,"easily","completely"],"heavy":"solution","led":true,"tower":false,"height":"mail","piece":false,"speed":"circus","not":true,"circus":"parent","gather":"sharp","material":1895962212,"shout":-880218541.8245034,"like":"manner","ever":false,"shoulder":-1512225048.9591174,"most":"tea","major":"very","split":1262964900.262394},1513505388,-1801554954.3218246,"right",false,837007242,"negative",-2059818836.7699537,false,false,false,true,"scientist",1511422517,-171714122,false,"thread","completely","married"],"farm":"example","duty":"section","office":"cent","land":true,"image":"read","attached":false,"water":false,"independent":false,"highway":"bill","everybody":"per","pen":"rock","living":-518598743,"detail":"stared","blew":"dawn","bat":false,"supper":"hang","question":true,"baby":-1215018745},"moon","coal",false,false,"ants","musical",false,-1673533129,49437218.06106043,-1463675570,"require","community",-49187634,"letter",true,"if","provide",1972275519],"grandfather",-1553834457,"twice",false,282277422.50585365,1470344686.0323844,true,false,true,1160105905.3826804,-955345487,1439776033,"sum",false,false,-1237769754.559866,false,1289321494],"boat":false,"point":-331426266.5311456,"afternoon":false,"lovely":"planet","officer":true,"plate":false,"each":"no","say":1322237584.2916708,"floor":1904871006,"engine":"greatly","just":false,"hot":"country","broad":-1414861232,"field":false,"faster":true,"having":1624219206,"band":false,"slope":true},"passage":"snow","industrial":-1195616102.610166,"aboard":true,"easier":874218913,"trade":false,"table":820550004.1760707,"making":"grew","smell":-1780065981,"lonely":true,"mistake":"movement","select":1750552600,"opposite":"shoot","softly":"shot","behavior":1468062641.0599828,"sense":"shine","block":false,"born":false,"outside":false}'; var testObject = JSON.parse(str); var copy = null;
Tests:
lodash cloneDeep
copy = _.cloneDeep(testObject);
structuredClone
copy = structuredClone(testObject);
JSON.parse JSON.stringify
copy = JSON.parse(JSON.stringify(testObject));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
lodash cloneDeep
structuredClone
JSON.parse JSON.stringify
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 appears that you are providing a benchmarking test case with four different methods to clone or serialize a JavaScript object: `_.cloneDeep`, `structuredClone`, `JSON.parse(JSON.stringify)`, and others. To answer your question, here is the updated output: 1. **Lodash Clone Deep**: The latest benchmark result for this method is 0.007 seconds (5463 executions per second). 2. **Structured Clone**: The latest benchmark result for this method is 0.012 seconds (5375 executions per second). 3. **JSON.parse(JSON.stringify)**: The latest benchmark result for this method is 0.021 seconds (3620 executions per second). Note that these results are based on the provided benchmarking data and may vary depending on the specific use case and system configuration. Additionally, I will provide a summary of the latest benchmark results: **Benchmark Summary** | **Test Name** | **Executions Per Second** | | --- | --- | | _.cloneDeep | 5463.34423828125 | | structuredClone | 5375.02197265625 | | JSON.parse(JSON.stringify) | 3620.163818359375 | Please let me know if you need further assistance or clarification on any aspect of this benchmarking test case.
Related benchmarks:
test clone
cloneJson Perf (reg json)
Deep Object Cloning
Deep Clone BenchMarks
Clone tests
Comments
Confirm delete:
Do you really want to delete benchmark?