Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash cloneDeep vs structuredClone loa-details
(version: 0)
https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
Comparing performance of:
Lodash cloneDeep vs Native structuredClone
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.21/lodash.min.js'></script>
Script Preparation code:
var MyObject = {"appVersion":"22.3.7","general":{"startMainHidden":false,"startMainMinimized":false,"closeToSystemTray":true,"saveScreenshots":true,"server":"steam","customLogPath":null,"useRawSocket":true,"listenPort":6040},"shortcuts":{"minimizeDamageMeter":{"value":"CommandOrControl+Down","defaultValue":"CommandOrControl+Down"},"resetSession":{"value":"CommandOrControl+Up","defaultValue":"CommandOrControl+Up"},"pauseDamageMeter":{"value":"CommandOrControl+Right","defaultValue":"CommandOrControl+Right"}},"uploads":{"uploadLogs":false,"uploadKey":"","api":{"value":"https://api.lail.ai","defaultValue":"https://api.lail.ai"},"endpoint":{"value":"/logs/upload","defaultValue":"/logs/upload"},"site":{"value":"https://lail.ai","defaultValue":"https://lail.ai"},"openOnUpload":false,"uploadUnlisted":true,"includeRegion":false},"damageMeter":{"functionality":{"dontResetOnZoneChange":false,"pauseOnPhaseTransition":true,"resetAfterPhaseTransition":true,"displayEsther":true,"estherColor":"#c2fc03","autoMinimize":false,"autoMinimizeTimer":60,"minimizeToTaskbar":false,"nameDisplay":"name+class","nameDisplayV2":"name+gear+class"},"design":{"compactDesign":false,"pinUserToTop":false,"opacity":0.9,"transparency":true},"header":{"damage":{"name":"Damage","enabled":true},"dps":{"name":"DPS","enabled":true},"tank":{"name":"Tanked","enabled":false},"bossHP":{"name":"Boss HP","enabled":false}},"tabs":{"damage":{"name":"Damage/Tanked","enabled":true},"deathTime":{"name":"Death Time","enabled":false},"damagePercent":{"name":"D% (Damage Percent)","enabled":true},"dps":{"name":"DPS/TPS","enabled":true},"critRate":{"name":"Crit Rate","enabled":true},"dBuffedBySup":{"name":"Dmg % dealt during Support buffs","enabled":false},"dDebuffedBySup":{"name":"Dmg % dealt during Support debuffs","enabled":false},"dPartyBuff":{"name":"Dmg % dealt during party synergies","enabled":true},"dSelfBuff":{"name":"Dmg % dealt during self synergies (set, food, engravings, skills)","enabled":true},"dOtherBuff":{"name":"Dmg % dealt during other buffs","enabled":false},"faRate":{"name":"Front Attack Rate","enabled":true},"baRate":{"name":"Back Attack Rate","enabled":true},"counterCount":{"name":"Counter Count","enabled":true},"hBuffedBySup":{"name":"Hit % dealt during Support buffs","enabled":false},"hDebuffedBySup":{"name":"Hit % dealt during Support debuffs","enabled":false},"hPartyBuff":{"name":"Hit % dealt during party synergies","enabled":false},"hSelfBuff":{"name":"Hit % dealt during self synergies (set, food, engravings, skills)","enabled":false},"hOtherBuff":{"name":"Hit % dealt during other buffs","enabled":false},"maxDmg":{"name":"Skill View / Max Damage","enabled":true},"avgDmg":{"name":"Skill View / Average Damage","enabled":true},"avgCast":{"name":"Skill View / Average Damage per Cast","enabled":false},"totalHits":{"name":"Skill View / Total Hits","enabled":true},"totalCasts":{"name":"Skill View / Total Casts","enabled":false},"hpm":{"name":"Skill View / Hits per Minute","enabled":true},"cpm":{"name":"Skill View / Casts per Minute","enabled":false},"shieldGiven":{"name":"Tab: Shield applied to other players","enabled":true},"shieldGotten":{"name":"Tab: Shield gotten from other players","enabled":false},"eshieldGiven":{"name":"Tab: Effective (used up) shield given to other players","enabled":true},"eshieldGotten":{"name":"Tab: Effective (used up) shield gotten from other players","enabled":false}},"buffFilter":{"party":135,"self":135,"other":262144},"classes":{"Warrior":{"color":"#000000","defaultColor":"#000000"},"Berserker":{"color":"#ee2e48","defaultColor":"#ee2e48"},"Destroyer":{"color":"#7b9aa2","defaultColor":"#7b9aa2"},"Gunlancer":{"color":"#E1907E","defaultColor":"#E1907E"},"Paladin":{"color":"#ff9900","defaultColor":"#ff9900"},"Female Warrior":{"color":"#000000","defaultColor":"#000000"},"Slayer":{"color":"#3c484f","defaultColor":"#3c484f"},"Mage":{"color":"#000000","defaultColor":"#000000"},"Arcanist":{"color":"#b38915","defaultColor":"#b38915"},"Summoner":{"color":"#22aa99","defaultColor":"#22aa99"},"Bard":{"color":"#674598","defaultColor":"#674598"},"Sorceress":{"color":"#66aa00","defaultColor":"#66aa00"},"Martial Artist (Female)":{"color":"#000000","defaultColor":"#000000"},"Wardancer":{"color":"#aaaa11","defaultColor":"#aaaa11"},"Scrapper":{"color":"#990099","defaultColor":"#990099"},"Soulfist":{"color":"#316395","defaultColor":"#316395"},"Glaivier":{"color":"#f6da6a","defaultColor":"#f6da6a"},"Martial Artist (Male)":{"color":"#000000","defaultColor":"#000000"},"Striker":{"color":"#994499","defaultColor":"#994499"},"Assassin":{"color":"#000000","defaultColor":"#000000"},"Deathblade":{"color":"#a91a16","defaultColor":"#a91a16"},"Shadowhunter":{"color":"#0099c6","defaultColor":"#0099c6"},"Reaper":{"color":"#109618","defaultColor":"#109618"},"Gunner (Male)":{"color":"#000000","defaultColor":"#000000"},"Sharpshooter":{"color":"#dd4477","defaultColor":"#dd4477"},"Deadeye":{"color":"#4442a8","defaultColor":"#4442a8"},"Artillerist":{"color":"#33670b","defaultColor":"#33670b"},"Machinist":{"color":"#3b4292","defaultColor":"#3b4292"},"Gunner (Female)":{"color":"#000000","defaultColor":"#000000"},"Gunslinger":{"color":"#6bcec2","defaultColor":"#6bcec2"},"Specialist":{"color":"#000000","defaultColor":"#000000"},"Artist":{"color":"#a34af0","defaultColor":"#a34af0"},"Aeromancer":{"color":"#084ba3","defaultColor":"#084ba3"},"Alchemist":{"color":"#3a945e","defaultColor":"#3a945e"}}},"logs":{"minimumSessionDurationInMinutes":1,"minimumEncounterDurationInMinutes":0.5,"minimumDurationInMinutes":0,"splitOnPhaseTransition":true,"multithreadParsing":true}}; var myCopy = null;
Tests:
Lodash cloneDeep
myCopy = _.cloneDeep(MyObject);
Native structuredClone
myCopy = structuredClone(MyObject);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash cloneDeep
Native structuredClone
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):
To solve this, we'll need to break down the provided information and identify the key components: 1. **Object**: `MyObject` is a JSON object with various properties (e.g., "Paladin", "Female Warrior", etc.). Each property has a `color` and `defaultColor`. 2. **Benchmark Data**: - Two individual test cases for cloning `MyObject` using: 1. Lodash's `cloneDeep` function. 2. The native `structuredClone` function (not available in all browsers; assuming it's supported). 3. **Latest Benchmark Result**: Two benchmark results, one for each cloning method, with metrics such as `ExecutionsPerSecond`. Given the complexity of this problem and without specific requirements on how to use or manipulate `MyObject`, I'll outline a general approach: ### Step 1: Prepare Your Environment Ensure you have Node.js installed along with Lodash (`npm install lodash`). ### Step 2: Define MyObject You need a way to define the `MyObject` structure. For simplicity, let's assume it as shown in your initial JSON data. ```javascript const MyObject = { "Paladin":{"color":"#ff9900","defaultColor":"#ff9900"}, // Add all properties here... } ``` ### Step 3: Write the Benchmark Code For the `Lodash cloneDeep` test: ```javascript import _ from 'lodash'; let myObject; // Load or define MyObject here... function runLodashClone() { const startTime = new Date().getTime(); let copy = _.cloneDeep(myObject); const endTime = new Date().getTime(); console.log(`Lodash cloneDeep took ${endTime - startTime}ms`); } runLodashClone(); ``` For the native `structuredClone` test: ```javascript function runStructuredClone() { const startTime = new Date().getTime(); let copy = structuredClone(myObject); const endTime = new Date().getTime(); console.log(`Native clone took ${endTime - startTime}ms`); } runStructuredClone(); ``` ### Step 4: Run the Benchmark Execute your code, and it will print out the execution times for both methods. ### Note: - The exact implementation might vary depending on whether you're using an online compiler or a local environment. Ensure that `MyObject` is accessible in the scope of your benchmark functions. - This solution doesn't account for edge cases like object circular references, which can affect performance. Always consider such scenarios when writing benchmarks. By following these steps, you should be able to create a basic setup to compare the execution times of `Lodash cloneDeep` and native `structuredClone`.
Related benchmarks:
Object Clone Lodash vs structuredClone
Lodash cloneDeep vs structuredClone vs JSON.stringify (small object)
Lodash cloneDeep vs structuredClone vs JSON-JSON
Lodash cloneDeep vs structuredClone 2asdasdas
Lodash cloneDeep vs structuredClone 2asdasdasrgdfg
Comments
Confirm delete:
Do you really want to delete benchmark?