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

16 lines
381 B
TypeScript
Raw Normal View History

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