X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fbench.mjs;h=a14ecd5f12086acf98e64cc2c877c68b0bbbf91f;hb=4a038312beabc5b06fd14c99a41670b8d8b18251;hp=205940c31dd6b000c2a21c18adfa7301cdcf359d;hpb=0819631dfe372ae4930cb476a7a81fb2f2a86804;p=poolifier.git diff --git a/benchmarks/internal/bench.mjs b/benchmarks/internal/bench.mjs index 205940c3..a14ecd5f 100644 --- a/benchmarks/internal/bench.mjs +++ b/benchmarks/internal/bench.mjs @@ -1,40 +1,45 @@ import { add, complete, cycle, save, suite } from 'benny' import { + Measurements, + PoolTypes, WorkerChoiceStrategies, + WorkerTypes, availableParallelism } from '../../lib/index.mjs' -import { - PoolTypes, - WorkerFunctions, - WorkerTypes -} from '../benchmarks-types.mjs' -import { buildPool, runTest } from '../benchmarks-utils.mjs' +import { TaskFunctions } from '../benchmarks-types.mjs' +import { buildPoolifierPool, runPoolifierTest } from '../benchmarks-utils.mjs' const poolSize = availableParallelism() const pools = [] for (const poolType of Object.values(PoolTypes)) { for (const workerType of Object.values(WorkerTypes)) { + if (workerType === WorkerTypes.cluster) { + continue + } for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) { - for (const tasksQueue of [false, true]) { - const pool = buildPool( - workerType, - poolType, - poolSize, - tasksQueue - ? { - ...{ - workerChoiceStrategy + for (const enableTasksQueue of [false, true]) { + if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) { + for (const measurement of [Measurements.runTime, Measurements.elu]) { + pools.push([ + `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}|measurement:${measurement}`, + buildPoolifierPool(workerType, poolType, poolSize, { + workerChoiceStrategy, + workerChoiceStrategyOptions: { + measurement }, - ...{ enableTasksQueue: true } - } - : { - workerChoiceStrategy - } - ) - pools.push([ - `${poolType}:${workerType}:${workerChoiceStrategy}:${tasksQueue}`, - pool - ]) + enableTasksQueue + }) + ]) + } + } else { + pools.push([ + `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}`, + buildPoolifierPool(workerType, poolType, poolSize, { + workerChoiceStrategy, + enableTasksQueue + }) + ]) + } } } } @@ -42,13 +47,13 @@ for (const poolType of Object.values(PoolTypes)) { const taskExecutions = 1 const workerData = { - function: WorkerFunctions.jsonIntegerSerialization, + function: TaskFunctions.jsonIntegerSerialization, taskSize: 1000 } const addPools = pools => pools.map(([name, pool]) => { return add(name, async () => { - await runTest(pool, { + await runPoolifierTest(pool, { taskExecutions, workerData })