Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Ramdajs
(version: 0)
Comparing performance of:
lodash cloneDeep vs ramdajs clone vs rfdc
Created:
5 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/rfdc@1.1.4/index.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>
Script Preparation code:
var temp1={ "objects": [ { "object1":{ "object2":{ "object3":{ "object4":{ "object5":"hello" } } } }, "type": "rect", "originX": "center", "originY": "center", "left": 300, "top": 150, "width": 150, "height": 150, "fill": "#29477F", "overlayFill": null, "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": { "color": "rgba(94, 128, 191, 0.5)", "blur": 5, "offsetX": 10, "offsetY": 10 }, "visible": true, "clipTo": null, "rx": 0, "ry": 0, "x": 0, "y": 0 }, { "type": "circle", "originX": "center", "originY": "center", "left": 300, "top": 400, "width": 200, "height": 200, "fill": "rgb(166,111,213)", "overlayFill": null, "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": { "color": "#5b238A", "blur": 20, "offsetX": -20, "offsetY": -10 }, "visible": true, "clipTo": null, "radius": 100 } ], "background": "1", } var copiedObject = null;
Tests:
lodash cloneDeep
copiedObject = _.cloneDeep(temp1);
ramdajs clone
copiedObject = R.clone(temp1);
rfdc
var clone = rfdc(); copiedObject = clone(temp1);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
lodash cloneDeep
ramdajs clone
rfdc
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):
Let's break down what is being tested on the provided JSON. The test cases are measuring the performance of three different approaches for cloning an object in JavaScript: 1. `_.cloneDeep` from Lodash: This function creates a deep copy of the input object, which means it recursively clones all nested objects and arrays. 2. `R.clone` from Ramda: Similar to Lodash's `_.cloneDeep`, this function also creates a deep copy of the input object. 3. `rfdc()` from Ramdajs: This function is specific to Ramdajs and is used to create a deep clone of the input object. Now, let's discuss the pros and cons of each approach: **Lodash's _.cloneDeep** Pros: * Widely supported and well-maintained library * Easy to use and understand Cons: * Can be slower than native JavaScript solutions due to its overhead **Ramda's R.clone** Pros: * Efficient and optimized for performance * Can be faster than Lodash's approach Cons: * May not be as widely supported or well-known as Lodash **rfdc() from Ramdajs** Pros: * Optimized specifically for performance in Ramdajs * May offer better performance compared to Lodash or Ramda Cons: * Limited support and usage outside of Ramdajs library * May require additional setup or configuration for use outside of the library Other considerations: * The use of `var` declarations for variables (`copiedObject`, `temp1`) is outdated in modern JavaScript. It's recommended to use `let` or `const` instead. * The `Script Preparation Code` section includes unnecessary `temp1` assignment, which can be removed for cleaner benchmarking. * The `Html Preparation Code` section imports several external libraries (Lodash, Ramda, and rfdc), which may impact performance or security. Alternatives to these approaches: * Native JavaScript `Object.assign()` method * Modern JavaScript spread operator (`...`) with `JSON.parse(JSON.stringify(obj))` * Other libraries like Immer.js or mobx for immutable data handling Keep in mind that the choice of approach depends on the specific use case, performance requirements, and personal preference.
Related benchmarks:
Array.prototype.map vs. Ramda.map
Array.prototype.map vs Ramda.map
Array (native) vs Ramda
Ramda map latest vs native Array.map
lodash vs ramda 1231jdasda
Comments
Confirm delete:
Do you really want to delete benchmark?