From 0ed6291efe58bddcfef9ae531ee90e0642b7cf88 Mon Sep 17 00:00:00 2001 From: mrmlnc Date: Sun, 27 Jun 2021 14:02:37 +0300 Subject: [PATCH] build: add `tiny-glob` to product synchronous benchmark --- .../suites/product/sync/tiny-glob.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/benchmark/suites/product/sync/tiny-glob.ts diff --git a/src/benchmark/suites/product/sync/tiny-glob.ts b/src/benchmark/suites/product/sync/tiny-glob.ts new file mode 100644 index 00000000..c1c72fc3 --- /dev/null +++ b/src/benchmark/suites/product/sync/tiny-glob.ts @@ -0,0 +1,24 @@ +import * as path from 'path'; + +import * as utils from '../../../utils'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports +import glob = require('tiny-glob/sync'); + +const options = { + cwd: path.join(process.cwd(), process.env.BENCHMARK_BASE_DIR as string), + flush: true +}; + +const timeStart = utils.timeStart(); + +try { + const matches = glob(process.env.BENCHMARK_PATTERN as string, options); + const memory = utils.getMemory(); + const time = utils.timeEnd(timeStart); + const measures = utils.formatMeasures(matches.length, time, memory); + + console.info(measures); +} catch { + process.exit(0); +}