build(deps-dev): apply updates
[poolifier.git] / benchmarks / internal / bench.mjs
... / ...
CommitLineData
1import {
2 PoolTypes,
3 WorkerTypes,
4 availableParallelism
5} from '../../lib/index.mjs'
6import { TaskFunctions } from '../benchmarks-types.mjs'
7import {
8 buildPoolifierPool,
9 runPoolifierPoolBenchmark
10} from '../benchmarks-utils.mjs'
11
12const poolSize = availableParallelism()
13const taskExecutions = 1
14const workerData = {
15 function: TaskFunctions.jsonIntegerSerialization,
16 taskSize: 1000
17}
18
19// FixedThreadPool
20await runPoolifierPoolBenchmark(
21 'Poolifier FixedThreadPool',
22 buildPoolifierPool(WorkerTypes.thread, PoolTypes.fixed, poolSize),
23 {
24 taskExecutions,
25 workerData
26 }
27)
28
29// DynamicThreadPool
30await runPoolifierPoolBenchmark(
31 'Poolifier DynamicThreadPool',
32 buildPoolifierPool(WorkerTypes.thread, PoolTypes.dynamic, poolSize),
33 {
34 taskExecutions,
35 workerData
36 }
37)