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