Skip to content

Commit

Permalink
feat(without): Add without function bench
Browse files Browse the repository at this point in the history
  • Loading branch information
iDevGon committed Jul 2, 2024
1 parent 4222ce4 commit 44086d2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions benchmarks/without.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { bench, describe } from 'vitest';
import { without as withoutEsToolkit } from 'es-toolkit';
import { without as withoutLodash } from 'lodash';

const generateArray = (length: number, max: number) => Array.from({ length }, () => Math.floor(Math.random() * max));

describe('without, small arrays', () => {
const array = [1, 2, 3, 4, 5];
const values = [2, 4];

bench('es-toolkit/without', () => {
withoutEsToolkit(array, ...values);
});

bench('lodash/without', () => {
withoutLodash(array, ...values);
});
});

describe('without, large arrays', () => {
const array = generateArray(10000, 1000);
const values = generateArray(100, 1000);

bench('es-toolkit/without', () => {
withoutEsToolkit(array, ...values);
});

bench('lodash/without', () => {
withoutLodash(array, ...values);
});
});

0 comments on commit 44086d2

Please sign in to comment.