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

14 lines
396 B
TypeScript

import { bench, describe } from 'vitest';
import { compact as compactToolkit } from 'es-toolkit';
import { compact as compactLodash } from 'lodash';
describe('compact', () => {
bench('es-toolkit', () => {
compactToolkit([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);
});
bench('lodash', () => {
compactLodash([0, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);
});
});