Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
deep clone - lodash vs ramda vs json (deep)
(version: 0)
Comparing performance of:
lodash - cloneDeep vs json - parse/stringify vs ramda - clone
Created:
3 years ago
by:
Registered User
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://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>
Script Preparation code:
var obj = { lcGsJoyg: 923, rnyCpgBp: 0.14232913002745584, fRdJYycV: false, MhcXxAvs: 823, xsgPPMlh: null, oiwmefHG: { UTUgyyYu: 0.8460004792043192, rFHXPYqw: null, eritVMnr: 0.21718792648430552, CmdVUytQ: { gPzaloRj: { vJGXVxJi: 724, GWoNVYgR: 'MtZHJ', NKYagqQy: null, dcENxKZF: 0.6580619745895702, wkcrUxzQ: 525, wdgfWxAt: { NWusGqvV: null, ocDTnuzA: { ireyJyPa: null, yBfgBsBF: true, ztkStRQt: 521, vIPrhOdP: { griUwbgI: 0.6655577562406807, lwnOKkjn: 'cQkIJ', QZZcwLJS: null, YHoBGUqM: 'UhtGd', iqcWrKdY: 0.20044669952640715, gJDPdldk: false, tDIfUrRm: 'AmJa' }, oajJQWPh: null, WNQzSlkO: 339, XctovUMs: { IMRZWJAL: 'imAem', SRZpRAES: 0.6581839734263002, nstaegiO: 'IAUTA', HXXWFiKI: 0.7565237544343479, OFtsaIuQ: null, HdVqUINd: true, cxYtCXsC: null } }, SjApjcJj: 0.41979165756875614, epIaqVXi: { oQwVxhtd: 0.48392401230685933, QDLIBEAH: 531, QwFecXMq: 0.09580261444084126, ZqdFSMfh: 'FIVHVE', AmKQZPtn: 0.4691995901700068, WAOnvuAW: 0.22911279743355517, cTroNQCg: { LtiZLnfc: true, QnQqXLCx: true, RwSeFGNT: 0.7892606890112777, acfSFjSC: 'nLKw', vkzyiybF: 762, mbHcTjTk: true, lpTXhJIu: 0.9044203649447724 } }, uszorzIa: 683, ZSXKrZcK: 589, EPIBxpda: false }, TAhWdyQI: { GmGlwadX: 0.07260820123948841, oUrEBIxh: false, QQVrfBgx: 'zHtTjJl', XVpvGtON: null, JpeRxiVu: 0.007310863658203104, rRaPAAoo: { XdyWuVLQ: 0.6644858232080231, jbNiHRoN: 979, UIzfbBVY: 'tgWe', RRBKfPBv: 0.4678891584339877, jkrRfnxD: 'ApqoGpi', tqbqMHjc: null, XNwMjMqz: false }, TWbSfQSL: 553 } }, bARzFicd: 371, voGDXchb: 0.404082207305148, czhHunfI: { PNJUgweg: true, aptcXaHr: 'ViLM', JCOHjPKW: 'LOnDG', EpSluekD: 'MNdzqj', kjzxbbtE: { gQRwBOFC: 26, zTHKGxpC: 'xMqaFQT', osxNVvGn: 0.9200386158505891, rhMbCUUz: 0.456411419439837, JLaOrbrA: 719, ONXnVuIH: 'FEzyY', KEPnDRhp: null }, gFOGssAr: true, YDoztSAx: false }, ncipQKiE: false, ORqLDzrJ: 678, VKbCMPyO: false }, LvesAdJX: false, MFRoToDJ: 377, sTaUMrMG: 'JEFnUl' }, PnRWMDwh: 'BphBF' } var objCopy = null;
Tests:
lodash - cloneDeep
objCopy = _.cloneDeep(obj);
json - parse/stringify
objCopy = JSON.parse(JSON.stringify(obj));
ramda - clone
objCopy = R.clone(obj);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
lodash - cloneDeep
json - parse/stringify
ramda - 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):
Based on the provided benchmark results, it appears that Ramda's `clone` function is the fastest, followed closely by Lodash's `cloneDeep` function, and then JSON parsing with `JSON.parse(JSON.stringify(obj))`. Therefore, the best answer would be: **Ramda's "clone" function**
Related benchmarks:
Deep Clone Performance - JSON vs Lodash vs Ramda vs Native
Lodash 2.2.0 cloneDeep vs JSON Clone w/ large nested object
Deep Clone Performance - JSON vs Lodash vs Ramda vs Native1
Lodash cloneDeep vs deepFreeze vs deepClone vs JSON.parse(JSON.stringify())
Object cloning with Lodash clone vs cloneDeep vs merge vs structuredClone vs JSON.parse(JSON.stringify(o)) 2
Comments
Confirm delete:
Do you really want to delete benchmark?