Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Deep merge lodash 4.12.21 vs ramda 0.27.1
(version: 0)
Comparing performance of:
Ramda.mergeDeepRight vs Lodash.merge
Created:
4 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/ramda@0.27.1/dist/ramda.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
Script Preparation code:
var obj1 = [ { "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0002", "type": "donut", "name": "Raised", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0003", "type": "donut", "name": "Old Fashioned", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ] var obj2 = [ { "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Overwritten" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [ { "id": "5001", "type": "Overwritten" }, { "id": "5002", "type": "Overwritten" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Overwritten" } ] }, { "id": "0002", "type": "Overwritten", "name": "Raised", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Overwritten" }, { "id": "5005", "type": "Sugar" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0003", "type": "Overwritten", "name": "Old Fashioned", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" }, { "id": "1002", "type": "Chocolate" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ]
Tests:
Ramda.mergeDeepRight
R.mergeDeepRight(obj1, obj2)
Lodash.merge
_.merge(obj1, obj2)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Ramda.mergeDeepRight
Lodash.merge
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):
A challenging question! To answer this question, I will need to parse the input JSON data and extract the relevant information. From the input JSON data: ``` { "type": "Overwritten", "name": "Raised", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Overwritten" }, { "id": "5005", "type": "Sugar" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ``` I will write a JavaScript code snippet that uses Ramda's `mergeDeepRight` function to merge the two objects: ```javascript const obj1 = { name: 'Overwritten', ppu: 0.55, batters: { batter: [ { id: '1001', type: 'Overwritten' } ] }, topping: [ { id: '5001', type: 'None' }, { id: '5002', type: 'Overwritten' }, { id: '5005', type: 'Sugar' }, { id: '5003', type: 'Chocolate' }, { id: '5004', type: 'Maple' } ] }; const obj2 = { name: 'Raised', ppu: 0.55, batters: { batter: [ { id: '1001', type: 'Overwritten' } ] }, topping: [ { id: '5001', type: 'None' }, { id: '5002', type: 'Glazed' }, { id: '5003', type: 'Chocolate' }, { id: '5004', type: 'Maple' } ] }; const result = R.mergeDeepRight(obj1, obj2); console.log(result); ``` This code snippet uses Ramda's `mergeDeepRight` function to merge the two objects. The resulting object will be: ```javascript { "name": "Overwritten", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ``` I will now compare the result with Lodash's `merge` function: ```javascript const obj1 = { name: 'Overwritten', ppu: 0.55, batters: { batter: [ { id: '1001', type: 'Overwritten' } ] }, topping: [ { id: '5001', type: 'None' }, { id: '5002', type: 'Overwritten' }, { id: '5005', type: 'Sugar' }, { id: '5003', type: 'Chocolate' }, { id: '5004', type: 'Maple' } ] }; const obj2 = { name: 'Raised', ppu: 0.55, batters: { batter: [ { id: '1001', type: 'Overwritten' } ] }, topping: [ { id: '5001', type: 'None' }, { id: '5002', type: 'Glazed' }, { id: '5003', type: 'Chocolate' }, { id: '5004', type: 'Maple' } ] }; const result = _.merge(obj1, obj2); console.log(result); ``` This code snippet uses Lodash's `merge` function to merge the two objects. The resulting object will be: ```javascript { "name": "Raised", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Overwritten" } ] }, "topping": [ { "id": "5001", type: "None" }, { "id": "5002", type: "Glazed" }, { "id": "5003", type: "Chocolate" }, { "id": "5004", type: "Maple" } ] } ``` I will now compare the results from both Ramda and Lodash. The resulting objects are different, which means that the merging process has produced a different outcome. Please let me know if I'm correct!
Related benchmarks:
Deep merge lodash 4.6.2 vs ramda vs deepmerge
Deep merge lodash vs ramda vs deepmerge !
Deep merge lodash vs ramda vs deepmerge vs json clone 3
Object Cloning Comparsion
Deep merge lodash vs ramda vs Immutable with multiple objects
Comments
Confirm delete:
Do you really want to delete benchmark?