From: Jérôme Benoit Date: Sun, 31 Mar 2024 00:08:43 +0000 (+0100) Subject: refactor: benchmark specific section X-Git-Tag: v3.1.28~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=083213c69e9aded7fac619d5d499a6ff527dbfba;p=poolifier.git refactor: benchmark specific section Signed-off-by: Jérôme Benoit --- diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 03596b27..f04e4d0f 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -100,23 +100,27 @@ export const runPoolifierBenchmarkBenchmarkJs = 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 }) + }, + { + onStart: () => { + pool.setWorkerChoiceStrategy(workerChoiceStrategy, { + measurement + }) + pool.enableTasksQueue(enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategy, + workerChoiceStrategy + ) + strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategyOptions.measurement, + measurement + ) + } } ) } @@ -126,17 +130,21 @@ export const runPoolifierBenchmarkBenchmarkJs = 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 }) + }, + { + onStart: () => { + pool.setWorkerChoiceStrategy(workerChoiceStrategy) + pool.enableTasksQueue(enableTasksQueue) + strictEqual( + pool.opts.workerChoiceStrategy, + workerChoiceStrategy + ) + strictEqual(pool.opts.enableTasksQueue, enableTasksQueue) + } } ) }