chore: v3.1.26
[poolifier.git] / benchmarks / internal / bench.mjs
... / ...
CommitLineData
1import { exit } from 'node:process'
2
3import {
4 availableParallelism,
5 PoolTypes,
6 WorkerTypes
7} from '../../lib/index.mjs'
8import { TaskFunctions } from '../benchmarks-types.cjs'
9import { runPoolifierPoolBenchmark } from '../benchmarks-utils.cjs'
10
11const poolSize = availableParallelism()
12const taskExecutions = 1
13const workerData = {
14 function: TaskFunctions.jsonIntegerSerialization,
15 taskSize: 1000
16}
17
18// FixedThreadPool
19await runPoolifierPoolBenchmark(
20 'FixedThreadPool',
21 WorkerTypes.thread,
22 PoolTypes.fixed,
23 poolSize,
24 {
25 taskExecutions,
26 workerData
27 }
28)
29
30// DynamicThreadPool
31await runPoolifierPoolBenchmark(
32 'DynamicThreadPool',
33 WorkerTypes.thread,
34 PoolTypes.dynamic,
35 poolSize,
36 {
37 taskExecutions,
38 workerData
39 }
40)
41
42// FixedClusterPool
43await runPoolifierPoolBenchmark(
44 'FixedClusterPool',
45 WorkerTypes.cluster,
46 PoolTypes.fixed,
47 poolSize,
48 {
49 taskExecutions,
50 workerData
51 }
52)
53
54// DynamicClusterPool
55await runPoolifierPoolBenchmark(
56 'DynamicClusterPool',
57 WorkerTypes.cluster,
58 PoolTypes.dynamic,
59 poolSize,
60 {
61 taskExecutions,
62 workerData
63 }
64)
65
66exit()