es-toolkit/benchmarks/performance/unionBy.bench.ts

14 lines
424 B
TypeScript
Raw Normal View History

2024-04-25 14:56:13 +03:00
import { bench, describe } from 'vitest';
import { unionBy as unionByToolkit } from 'es-toolkit';
import { unionBy as unionByLodash } from 'lodash';
describe('unionBy', () => {
bench('es-toolkit/unionBy', () => {
2024-04-25 14:56:13 +03:00
unionByToolkit([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], x => x.id);
});
2024-04-25 14:56:13 +03:00
bench('lodash/unionBy', () => {
2024-04-25 14:56:13 +03:00
unionByLodash([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], x => x.id);
});
});