es-toolkit/benchmarks/performance/sample.bench.ts
2024-07-17 11:47:39 +09:00

16 lines
381 B
TypeScript

import { bench, describe } from 'vitest';
import { sample as sampleToolkit } from 'es-toolkit';
import { sample as sampleLodash } from 'lodash';
describe('sample', () => {
bench('es-toolkit/sample', () => {
const array = [1, 2, 3, 4, 5];
sampleToolkit(array);
});
bench('lodash/sample', () => {
const array = [1, 2, 3, 4, 5];
sampleLodash(array);
});
});