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