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