build(deps-dev): apply updates
[benchmarks-js.git] / deep-merge-object.mjs
1 import deepMerge from 'deepmerge'
2 import _ from 'lodash'
3 import { mergeDeepRight } from 'rambda'
4 import { bench, group, run } from 'tatami-ng'
5
6 import { generateRandomObject } from './benchmark-utils.mjs'
7
8 const object = generateRandomObject()
9 const objectToMerge = generateRandomObject()
10
11 group(
12 `Deep merge two objects: object with ${
13 Object.keys(object).length
14 } keys, object with ${Object.keys(objectToMerge).length} keys`,
15 () => {
16 bench('lodash merge', (obj = object) => {
17 _.merge(obj, objectToMerge)
18 })
19 bench('rambda mergeDeepRight', (obj = object) => {
20 mergeDeepRight(obj, objectToMerge)
21 })
22 bench('deepmerge', (obj = object) => {
23 deepMerge(obj, objectToMerge)
24 })
25 }
26 )
27
28 await run({
29 units: true,
30 })