"mochawesome",
"MYBENCH",
"nocombine",
+ "nproc",
"octocat",
"opencollective",
"OPTARG",
case WorkerTypes.thread:
return new DynamicThreadPool(
Math.floor(poolSize / 2),
- poolSize * 3,
+ poolSize,
'./benchmarks/internal/thread-worker.mjs',
poolOptions
)
case WorkerTypes.cluster:
return new DynamicClusterPool(
Math.floor(poolSize / 2),
- poolSize * 3,
+ poolSize,
'./benchmarks/internal/cluster-worker.mjs',
poolOptions
)
taskType=${taskType:-'CPU_INTENSIVE'}
taskSize=${taskSize:-5000}
-poolSize=${poolSize:-10}
+poolSize=${poolSize:-$(nproc --all)}
iterations=${iterations:-100000}
echo 'Running benchmarks with pool size:' ${poolSize}', number of iterations:' ${iterations}', task type:' ${taskType} 'and task size:' ${taskSize}
const piscina = new Piscina({
filename: './workers/piscina/function-to-bench-worker.mjs',
- minThreads: size,
- maxThreads: size * 3,
+ minThreads: Math.floor(size / 2),
+ maxThreads: size,
idleTimeout: 60000 // this is the same as poolifier default
})
}
const dynamicPool = new DynamicThreadPool(
+ Math.floor(size / 2),
size,
- size * 3,
'./workers/poolifier/function-to-bench-worker.mjs'
)
const tinypool = new Tinypool({
filename: './workers/tinypool/function-to-bench-worker.mjs',
- minThreads: size,
- maxThreads: size * 3,
+ minThreads: Math.floor(size / 2),
+ maxThreads: size,
idleTimeout: 60000 // this is the same as poolifier default
})
const workerNodes = new WorkerNodes(
require.resolve('./workers/worker-nodes/function-to-bench-worker'),
{
- minWorkers: size,
- maxWorkers: size * 3,
+ minWorkers: Math.floor(size / 2),
+ maxWorkers: size,
taskTimeout: 60000 // this is the same as poolifier default
}
)
const workerPool = workerpool.pool(
'./workers/workerpool/function-to-bench-worker.mjs',
{
- minWorkers: size,
- maxWorkers: size * 3,
+ minWorkers: Math.floor(size / 2),
+ maxWorkers: size,
workerType: 'thread'
}
)