mirror of
https://github.com/toss/es-toolkit.git
synced 2024-12-11 08:54:07 +03:00
3cc1a03519
* chore: add codspeed * chore: fix the benchmark file to clearly distinguish between the comparison targets * chore: fix typo
20 lines
745 B
TypeScript
20 lines
745 B
TypeScript
import { bench, describe } from 'vitest';
|
|
import { intersectionWith as intersectionWithToolkit } from 'es-toolkit';
|
|
import { intersectionWith as intersectionWithLodash } from 'lodash';
|
|
|
|
describe('intersectionWith', () => {
|
|
bench('es-toolkit/intersectionWith', () => {
|
|
const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
const array2 = [{ id: 2 }, { id: 4 }];
|
|
const areItemsEqual = (a, b) => a.id === b.id;
|
|
intersectionWithToolkit(array1, array2, areItemsEqual);
|
|
});
|
|
|
|
bench('lodash/intersectionWith', () => {
|
|
const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }];
|
|
const array2 = [{ id: 2 }, { id: 4 }];
|
|
const areItemsEqual = (a, b) => a.id === b.id;
|
|
intersectionWithLodash(array1, array2, areItemsEqual);
|
|
});
|
|
});
|