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

24 lines
624 B
TypeScript

import { bench, describe } from 'vitest';
import { fill as fillLodash } from 'lodash';
import { toFilled as toFilledToolkit } from 'es-toolkit';
describe('fill function performance comparison', () => {
bench('es-toolkit/toFilled', () => {
toFilledToolkit([1, 2, 3, 4, 5], '*');
});
bench('lodash/fill', () => {
fillLodash([1, 2, 3, 4, 5], '*');
});
});
describe('fill function performance with custom start and end', () => {
bench('es-toolkit/toFilled', () => {
toFilledToolkit([1, 2, 3, 4, 5], '*', 1, 3);
});
bench('lodash/fill', () => {
fillLodash([1, 2, 3, 4, 5], '*', 1, 3);
});
});