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', () => {
|
2024-06-18 04:40:07 +03:00
|
|
|
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-06-04 11:19:26 +03:00
|
|
|
});
|
2024-04-25 14:56:13 +03:00
|
|
|
|
2024-06-18 04:40:07 +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);
|
2024-06-04 11:19:26 +03:00
|
|
|
});
|
|
|
|
});
|