Commit | Line | Data |
---|---|---|
896570f7 | 1 | /* eslint-disable no-unused-vars */ |
896570f7 | 2 | import deepMerge from 'deepmerge' |
0c01f51c | 3 | import _ from 'lodash' |
ab9a08f3 | 4 | import { mergeDeepRight } from 'rambda' |
4676a95c | 5 | import { bench, group, run } from 'tatami-ng' |
0c01f51c | 6 | |
896570f7 JB |
7 | import { generateRandomObject } from './benchmark-utils.mjs' |
8 | ||
9 | const object = generateRandomObject() | |
10 | const objectToMerge = generateRandomObject() | |
11 | ||
ab9a08f3 | 12 | group( |
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 | ||
29 | await run({ | |
30 | units: true | |
31 | }) |