build(deps): bump poolifier
[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'
f1c674cd 7import {
f1c674cd 8 buildPoolifierPool,
cde5b54e 9 runPoolifierPoolBenchmark
ab7bb4f8 10} from '../benchmarks-utils.js'
cdace0e5 11
d09b37fc 12const poolSize = availableParallelism()
cdace0e5
JB
13const taskExecutions = 1
14const workerData = {
dbca3be9 15 function: TaskFunctions.jsonIntegerSerialization,
e8114b23 16 taskSize: 1000
cdace0e5 17}
f1c674cd 18
cde5b54e
JB
19// FixedThreadPool
20await runPoolifierPoolBenchmark(
21 'Poolifier FixedThreadPool',
22 buildPoolifierPool(WorkerTypes.thread, PoolTypes.fixed, poolSize),
23 {
24 taskExecutions,
25 workerData
1676d5b1 26 }
cde5b54e 27)
325f50bc 28
cde5b54e
JB
29// DynamicThreadPool
30await runPoolifierPoolBenchmark(
31 'Poolifier DynamicThreadPool',
32 buildPoolifierPool(WorkerTypes.thread, PoolTypes.dynamic, poolSize),
33 {
34 taskExecutions,
35 workerData
36 }
37)
ab7bb4f8
JB
38
39// FixedClusterPool
40await runPoolifierPoolBenchmark(
41 'Poolifier FixedClusterPool',
42 buildPoolifierPool(WorkerTypes.cluster, PoolTypes.fixed, poolSize),
43 {
44 taskExecutions,
45 workerData
46 }
47)
48
49// DynamicClusterPool
50await runPoolifierPoolBenchmark(
51 'Poolifier DynamicClusterPool',
52 buildPoolifierPool(WorkerTypes.cluster, PoolTypes.dynamic, poolSize),
53 {
54 taskExecutions,
55 workerData
56 }
57)