Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash merge vs mergedeep
(version: 0)
Comparing performance of:
Lodash.merge vs deepmerge
Created:
one year 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 src='https://unpkg.com/deepmerge@4.3.1/dist/umd.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:
Lodash.merge
_.merge(obj1, obj2)
deepmerge
deepmerge(obj1, obj2)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash.merge
deepmerge
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Browser/OS:
Chrome 129 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash.merge
85057.3 Ops/sec
deepmerge
64064.5 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
A complex JavaScript code snippet! After analyzing the code, I will attempt to answer your questions. **1. What is the purpose of this code snippet?** This code snippet appears to be a benchmarking test for two JavaScript libraries: Lodash and Deep Merge. The code defines two object merge functions (`_.merge` and `deepmerge`) and compares their execution performance. **2. What are the differences between Lodash.merge and deepmerge?** Lodash's `_.merge` function is a more general-purpose merging function that can handle complex data structures, including nested objects. Deep Merge, on the other hand, is a lightweight, fast, and flexible merge function specifically designed for deep object merges. **3. What are the individual test cases?** There are two test cases: * **Lodash.merge**: This test case uses Lodash's `_.merge` function to compare its performance with Deep Merge. * **deepmerge**: This test case uses Deep Merge to compare its performance with Lodash's `_.merge` function. **4. What is the Latest benchmark result?** The latest benchmark result shows two browsers running the tests: * Chrome 129 (Mac OS X 10.15.7): Executed Lodash.merge 85057 times per second. * Chrome 129 (Mac OS X 10.15.7): Executed Deep Merge 64064 times per second. **5. What is the Html Preparation Code?** The HTML preparation code includes two JavaScript libraries: * `lodash.min.js` (version 4.17.21) * `umd.js` from Deep Merge library (version 4.3.1) These libraries are likely included in the benchmarking test to ensure that they are properly loaded and executed by the browser. Please let me know if you have any further questions or if there's anything else I can help you with!
Related benchmarks:
lodash groupBy vs Array.reduce [correct] 100k
lodash groupBy vs Array.reduce 100k corrected
lodash groupBy vs Array.reduce 100
lodash flatten vs array.flatMap
lodash flatten vs array.flatMap corrected transform
Comments
Confirm delete:
Do you really want to delete benchmark?