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