Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
CloneDeep vs Custom Clone Deep Conditional Props Fix
(version: 0)
Comparing performance of:
Lodash vs Custom vs Stringify parse
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 Preparation code:
var MyObject = { description: 'Creates a deep copy of source, which should be an object or an array.', myNumber: 123456789, myBoolean: true, jayson: { stringify: 'JSON.stringify() method converts a JavaScript value to a JSON string....', parse: 'JSON.parse() method parses a JSON string...', test: [789, 456, 123], htest: [123, 456, 789], } }; var manual = (obj) => ({ ...obj.description && { description: obj.description, }, ...obj.myBoolean && { myBoolean: obj.myBoolean, }, ...obj.myNumber && { myNumber: obj.myNumber, }, ...obj.jayson && { jayson: {...obj.jayson} } });
Tests:
Lodash
const myCopy = _.cloneDeep(MyObject);
Custom
const myCopy = manual(MyObject);
Stringify parse
const myCopy = JSON.parse(JSON.stringify(MyObject));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lodash
Custom
Stringify parse
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!
Related benchmarks:
CloneDeep vs Custom Clone Deep Conditional Props
is lodash cloneDeep the BEST object deep cloner ? what about native structuredClone function ?
Deep cloning of arrays with objects
Lodash cloneDeep vs JSON parse
Comments
Confirm delete:
Do you really want to delete benchmark?