es-toolkit/benchmarks/performance/merge.bench.ts
2024-08-10 15:38:41 +09:00

27 lines
567 B
TypeScript

import { bench, describe } from 'vitest';
import { merge as mergeToolkit } from 'es-toolkit';
import { merge as mergeCompatToolkit } from 'es-toolkit/compat';
import { merge as mergeLodash } from 'lodash';
const object = {
a: [{ b: 2 }, { d: 4 }],
};
const other = {
a: [{ c: 3 }, { e: 5 }],
};
describe('merge', () => {
bench('lodash/merge', () => {
mergeLodash(object, other);
});
bench('es-toolkit/merge', () => {
mergeToolkit(object, other);
});
bench('es-toolkit/compat/merge', () => {
mergeCompatToolkit(object, other);
});
});