To compare poolifier pools with other worker pools, we use hyperfine, which runs each pool in an isolated Node.js process so that no pool impacts another.
-
External pools with which we compare the poolifier results:
-
External pools with which we used to compare the poolifier results:
- node-worker-threads-pool: removed because it does not support dynamic module imports or importing the task function outside the worker; the task function is expected to be self-contained, which makes it impractical to use without ugly hacks.
- worker-threads-pool: removed because unmaintained since more than 4 years.
- threadwork: removed because unmaintained since more than 3 years.
- microjob: removed because unmaintained since more than 5 years.
- threads.js: removed because not a threads pool.
⚠️ We would need funds to run our benchmark more often and on Cloud VMs, please consider to sponsor the poolifier project
Each measured pool has two variants in this repository:
dynamic-*.mjs(or.cjs): configured with a minimum ofMath.floor(poolSize / 2)and a maximum ofpoolSizeworkers. The exact floor depends on the pool's semantics — workerpool'sminWorkersis a real lower-bound count, while worker-nodes treatsminWorkersas an availability threshold rather than a fixed count — so the configured bounds are the reference, not an exact worker count.fixed-*.mjs(or.cjs): the pool is configured withpoolSizeworkers (no scale-down between a min and a max).
To run the benchmark, you will need to:
- Install hyperfine
- Clone the benchmark repository
- Run
pnpm installin the benchmark cloned repository - Run the
./bench.shscript - Run
pnpm testfor a quick smoke check of every measured pool (2 iterations, 2 workers and task size 10 per pool by default;NUM_ITERATIONS,POOL_SIZE,TASK_SIZEandTASK_TYPEare honored)
bench.sh honors the same environment variables. Precedence: defaults < NUM_ITERATIONS/POOL_SIZE/TASK_SIZE/TASK_TYPE (environment) < -s/-i/-t/-n (flags). POOL_SIZE is capped at 256 (auto-detected values are not capped), NUM_ITERATIONS at 10,000,000 and TASK_SIZE at 10,000; empty values are rejected, not silently defaulted.
⚠️ Please be sure to use a quiet PC when you run the benchmark
CPU intensive task (default CPU_INTENSIVE mode) with 100,000 factorial(1000) operations submitted to each pool: bencher.dev.