1 import { add, complete, cycle, save, suite } from 'benny'
5 WorkerChoiceStrategies,
8 } from '../../lib/index.mjs'
9 import { TaskFunctions } from '../benchmarks-types.mjs'
10 import { buildPool, runTest } from '../benchmarks-utils.mjs'
12 const poolSize = availableParallelism()
14 for (const poolType of Object.values(PoolTypes)) {
15 for (const workerType of Object.values(WorkerTypes)) {
16 if (workerType === WorkerTypes.cluster) {
19 for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
20 for (const enableTasksQueue of [false, true]) {
21 if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
22 for (const measurement of [Measurements.runTime, Measurements.elu]) {
24 `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}|measurement:${measurement}`,
25 buildPool(workerType, poolType, poolSize, {
27 workerChoiceStrategyOptions: {
36 `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}`,
37 buildPool(workerType, poolType, poolSize, {
48 const taskExecutions = 1
50 function: TaskFunctions.jsonIntegerSerialization,
53 const addPools = (pools) =>
54 pools.map(([name, pool]) => {
55 return add(name, async () => {
63 const resultsFile = 'poolifier'
64 const resultsFolder = 'benchmarks/internal/results'
72 folder: resultsFolder,
78 folder: resultsFolder,
84 folder: resultsFolder,
90 // eslint-disable-next-line n/no-process-exit
93 .catch((err) => console.error(err))