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