X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fbenchmarks-utils.mjs;h=35c335c45877748ec332e45cd10fda5e5d4b69df;hb=a191d3fbb41de19e0175fe793fa3590c7d8705ab;hp=48101fdaadc434073f81906a0ad0d7095e3f675a;hpb=16534b4212013e58407946c95a53db4d8512d512;p=poolifier.git diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 48101fda..35c335c4 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -1,7 +1,7 @@ import { strictEqual } from 'node:assert' import Benchmark from 'benchmark' -import { bench, clear, group, run } from 'mitata' +import { bench, clear, group, run } from 'tatami-ng' import { DynamicClusterPool, @@ -249,7 +249,7 @@ export const runPoolifierBenchmarkBenchmarkJsSuite = async ( }) } -export const runPoolifierBenchmarkMitata = async ( +export const runPoolifierBenchmarkTatamiNg = async ( name, workerType, poolType, @@ -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) }