From 2baf75cf2d61770b18355d4801101c143d64c20d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 6 Apr 2024 18:27:15 +0200 Subject: [PATCH] perf(benchmark): only benchmark poolifier run with mitata MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-utils.mjs | 50 +++++++++++++++++++-------------- package.json | 2 +- pnpm-lock.yaml | 10 +++---- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 48101fda..06ebbfa1 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -268,23 +268,27 @@ export const runPoolifierBenchmarkMitata = async ( enableTasksQueue ? 'with' : 'without' } tasks queue`, async () => { - pool.setWorkerChoiceStrategy(workerChoiceStrategy, { - measurement - }) - pool.enableTasksQueue(enableTasksQueue) - strictEqual( - pool.opts.workerChoiceStrategy, - workerChoiceStrategy - ) - strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) - strictEqual( - pool.opts.workerChoiceStrategyOptions.measurement, - measurement - ) await runPoolifierPool(pool, { taskExecutions, workerData }) + }, + { + before: () => { + pool.setWorkerChoiceStrategy(workerChoiceStrategy, { + measurement + }) + pool.enableTasksQueue(enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategy, + workerChoiceStrategy + ) + strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategyOptions.measurement, + measurement + ) + } } ) }) @@ -296,17 +300,21 @@ export const runPoolifierBenchmarkMitata = async ( enableTasksQueue ? 'with' : 'without' } tasks queue`, async () => { - pool.setWorkerChoiceStrategy(workerChoiceStrategy) - pool.enableTasksQueue(enableTasksQueue) - strictEqual( - pool.opts.workerChoiceStrategy, - workerChoiceStrategy - ) - strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) await runPoolifierPool(pool, { taskExecutions, workerData }) + }, + { + before: () => { + pool.setWorkerChoiceStrategy(workerChoiceStrategy) + pool.enableTasksQueue(enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategy, + workerChoiceStrategy + ) + strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) + } } ) }) @@ -314,8 +322,8 @@ export const runPoolifierBenchmarkMitata = async ( } } await run() - await pool.destroy() clear() + await pool.destroy() } catch (error) { console.error(error) } diff --git a/package.json b/package.json index 1a54f8d5..96e7e9e8 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "husky": "^9.0.11", "lint-staged": "^15.2.2", "microtime": "^3.1.1", - "mitata": "github:jerome-benoit/mitata#master", + "mitata": "github:poolifier/mitata#master", "mocha": "^10.4.0", "mochawesome": "^7.1.3", "prettier": "^3.2.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6577e06a..be574dd4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -96,8 +96,8 @@ devDependencies: specifier: ^3.1.1 version: 3.1.1 mitata: - specifier: github:jerome-benoit/mitata#master - version: github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2(typescript@5.4.4) + specifier: github:poolifier/mitata#master + version: github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34(typescript@5.4.4) mocha: specifier: ^10.4.0 version: 10.4.0 @@ -5777,9 +5777,9 @@ packages: engines: {node: '>=12.20'} dev: true - github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2(typescript@5.4.4): - resolution: {tarball: https://codeload.github.com/jerome-benoit/mitata/tar.gz/07d9e3698201592d5babe9b8eaa58534ddeb6bd2} - id: github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2 + github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34(typescript@5.4.4): + resolution: {tarball: https://codeload.github.com/poolifier/mitata/tar.gz/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34} + id: github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34 name: mitata version: 0.1.11 requiresBuild: true -- 2.34.1