X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fbench.mjs;h=193827f3a24da416f58e079dd8cd546c8b50d8cd;hb=a9780ad2992ef19ef824da2d796433fc7f193ec8;hp=205940c31dd6b000c2a21c18adfa7301cdcf359d;hpb=0819631dfe372ae4930cb476a7a81fb2f2a86804;p=poolifier.git diff --git a/benchmarks/internal/bench.mjs b/benchmarks/internal/bench.mjs index 205940c3..193827f3 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 { TaskFunctions } from '../benchmarks-types.mjs' import { buildPool, runTest } 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}`, + buildPool(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}`, + buildPool(workerType, poolType, poolSize, { + workerChoiceStrategy, + enableTasksQueue + }) + ]) + } } } } @@ -42,10 +47,10 @@ for (const poolType of Object.values(PoolTypes)) { const taskExecutions = 1 const workerData = { - function: WorkerFunctions.jsonIntegerSerialization, + function: TaskFunctions.jsonIntegerSerialization, taskSize: 1000 } -const addPools = pools => +const addPools = (pools) => pools.map(([name, pool]) => { return add(name, async () => { await runTest(pool, { @@ -85,4 +90,4 @@ suite( // eslint-disable-next-line n/no-process-exit return process.exit() }) - .catch(err => console.error(err)) + .catch((err) => console.error(err))