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