To run the internal benchmark, you just need to navigate to the root of poolifier cloned repository and run `pnpm benchmark`.
-### [Results](https://poolifier.github.io/benchmark-results/dev/bench)
+### [Results](https://bencher.dev/perf/poolifier)
const runPoolifierPoolBenchmark = async (
name,
- pool,
+ workerType,
+ poolType,
+ poolSize,
{ taskExecutions, workerData }
) => {
+ const pool = buildPoolifierPool(workerType, poolType, poolSize)
+ const suite = new Benchmark.Suite(name)
return await new Promise((resolve, reject) => {
try {
- const suite = new Benchmark.Suite(name)
for (const workerChoiceStrategy of Object.values(
WorkerChoiceStrategies
)) {
LIST_FORMATTER.format(this.filter('fastest').map('name'))
)
await pool.destroy()
- pool = undefined
resolve()
})
.run({ async: true })
} catch (error) {
- reject(error)
+ pool
+ .destroy()
+ .then(() => {
+ return reject(error)
+ })
+ .catch(() => {})
}
})
}
module.exports = {
LIST_FORMATTER,
- buildPoolifierPool,
executeTaskFunction,
generateRandomInteger,
runPoolifierPoolBenchmark
availableParallelism
} from '../../lib/index.mjs'
import { TaskFunctions } from '../benchmarks-types.js'
-import {
- buildPoolifierPool,
- runPoolifierPoolBenchmark
-} from '../benchmarks-utils.js'
+import { runPoolifierPoolBenchmark } from '../benchmarks-utils.js'
const poolSize = availableParallelism()
const taskExecutions = 1
// FixedThreadPool
await runPoolifierPoolBenchmark(
'Poolifier FixedThreadPool',
- buildPoolifierPool(WorkerTypes.thread, PoolTypes.fixed, poolSize),
+ WorkerTypes.thread,
+ PoolTypes.fixed,
+ poolSize,
{
taskExecutions,
workerData
// DynamicThreadPool
await runPoolifierPoolBenchmark(
'Poolifier DynamicThreadPool',
- buildPoolifierPool(WorkerTypes.thread, PoolTypes.dynamic, poolSize),
+ WorkerTypes.thread,
+ PoolTypes.dynamic,
+ poolSize,
{
taskExecutions,
workerData
// FixedClusterPool
await runPoolifierPoolBenchmark(
'Poolifier FixedClusterPool',
- buildPoolifierPool(WorkerTypes.cluster, PoolTypes.fixed, poolSize),
+ WorkerTypes.cluster,
+ PoolTypes.fixed,
+ poolSize,
{
taskExecutions,
workerData
// DynamicClusterPool
await runPoolifierPoolBenchmark(
'Poolifier DynamicClusterPool',
- buildPoolifierPool(WorkerTypes.cluster, PoolTypes.dynamic, poolSize),
+ WorkerTypes.cluster,
+ PoolTypes.dynamic,
+ poolSize,
{
taskExecutions,
workerData