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

18 lines
440 B
TypeScript
Raw Normal View History

2024-04-25 14:56:13 +03:00
import { union as unionToolkit } from 'es-toolkit';
import { union as unionLodash } from 'lodash';
import { bench, describe } from 'vitest';
2024-04-25 14:56:13 +03:00
describe('union', () => {
bench('es-toolkit/union', () => {
2024-04-25 14:56:13 +03:00
const array1 = [1, 2, 3];
const array2 = [3, 4, 5];
unionToolkit(array1, array2);
});
2024-04-25 14:56:13 +03:00
bench('lodash/union', () => {
2024-04-25 14:56:13 +03:00
const array1 = [1, 2, 3];
const array2 = [3, 4, 5];
unionLodash(array1, array2);
});
});