From 44086d27d64e370c57398b081edfd445c7e5ffd6 Mon Sep 17 00:00:00 2001 From: DevGon Date: Wed, 3 Jul 2024 00:01:04 +0900 Subject: [PATCH] feat(without): Add `without` function bench --- benchmarks/without.bench.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 benchmarks/without.bench.ts diff --git a/benchmarks/without.bench.ts b/benchmarks/without.bench.ts new file mode 100644 index 000000000..f8cbd26f0 --- /dev/null +++ b/benchmarks/without.bench.ts @@ -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); + }); +});