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