Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash merge vs deepmerge vs ramda merge
(version: 0)
Comparing performance of:
lodash merge vs object.assign vs ramda
Created:
4 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 src='https://unpkg.com/deepmerge@3.2.0/dist/umd.js'></script> <script src="//cdn.jsdelivr.net/npm/ramda@latest/dist/ramda.min.js"></script>
Tests:
lodash merge
var a = { a: 'oh', b: 'my', c: { a: 'a', b: { c: 'c' } } }; var b = { c: { b: { d: 'a' }, c: { d: 'd' } } }; var c = _.merge({}, a, b);
object.assign
var a = { a: 'oh', b: 'my', c: { a: 'a', b: { c: 'c' } } }; var b = { c: { b: { d: 'a' }, c: { d: 'd' } } }; var c = deepmerge({}, a, b);
ramda
var a = { a: 'oh', b: 'my', c: { a: 'a', b: { c: 'c' } } }; var b = { c: { b: { d: 'a' }, c: { d: 'd' } } }; var c = R.mergeDeepLeft(a, b);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
lodash merge
object.assign
ramda
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/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Browser/OS:
Chrome 136 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
lodash merge
298339.1 Ops/sec
object.assign
1790386.6 Ops/sec
ramda
1436210.8 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
**Overview** MeasureThat.net is a website that allows users to create and run JavaScript microbenchmarks, comparing the performance of different libraries and approaches. **Benchmark Definition Json** The provided JSON represents a benchmark definition, which outlines the test cases: * `Name`: The name of the benchmark, "lodash merge vs deepmerge vs ramda merge". * `Description`: None. * `Script Preparation Code`: A script that loads the required JavaScript libraries: Lodash, Deepmerge, and Ramda. * `Html Preparation Code`: An HTML snippet that includes a script tag for each library. **Individual Test Cases** There are three individual test cases: 1. **Lodash Merge (`lodash merge`)**: * Benchmark Definition: Uses the `_` object from Lodash to create a new object with merged properties from two objects. * Purpose: Test the performance of Lodash's `merge` function. 2. **Object Assign (`object.assign`)**: * Benchmark Definition: Uses the `Object.assign()` method to merge two objects. * Purpose: Test the performance of the built-in `Object.assign()` method. 3. **Ramda Merge (`ramda`)**: * Benchmark Definition: Uses Ramda's `R.mergeDeepLeft()` function to create a new object with merged properties from two objects. * Purpose: Test the performance of Ramda's `mergeDeepLeft` function. **Comparison of Approaches** The three test cases compare different approaches for merging objects: 1. **Lodash Merge**: Uses a custom implementation in Lodash, which creates a new object with merged properties. 2. **Object Assign**: Uses the built-in `Object.assign()` method, which merges two objects into one. 3. **Ramda Merge**: Uses Ramda's `mergeDeepLeft` function, which recursively merges properties from two objects. **Pros and Cons** Here are some pros and cons of each approach: * **Lodash Merge**: + Pros: Custom implementation can be optimized for performance. + Cons: Requires loading Lodash library, which may have overhead. * **Object Assign**: + Pros: Built-in method with low overhead. + Cons: May not provide optimal merging behavior for complex objects. * **Ramda Merge**: + Pros: Provides a clear and concise API for object merging. + Cons: Requires loading Ramda library, which may have overhead. **Library Descriptions** 1. **Lodash**: A popular JavaScript utility library that provides various functions for tasks such as array manipulation, string iteration, and object merging. 2. **Deepmerge**: A lightweight object merging library that provides a simple API for merging objects. 3. **Ramda**: A functional programming library that provides a wide range of functions for data processing, including object merging. **Special JS Features or Syntax** None mentioned in the provided benchmark definition json.
Related benchmarks:
lodash merge vs deepmerge.all
lodash merge vs deepmerge vs ramda
lodash merge vs deepmerge latest CDN
lodash merge vs deepmerge vs Object.assign
Comments
Confirm delete:
Do you really want to delete benchmark?