Commit | Line | Data |
---|---|---|
00a2ffdb | 1 | import { exit } from 'node:process' |
d09b37fc | 2 | import { |
d9d8c14e | 3 | PoolTypes, |
d9d8c14e | 4 | WorkerTypes, |
d09b37fc JB |
5 | availableParallelism |
6 | } from '../../lib/index.mjs' | |
d35e5717 JB |
7 | import { TaskFunctions } from '../benchmarks-types.cjs' |
8 | import { runPoolifierPoolBenchmark } from '../benchmarks-utils.cjs' | |
cdace0e5 | 9 | |
d09b37fc | 10 | const poolSize = availableParallelism() |
cdace0e5 JB |
11 | const taskExecutions = 1 |
12 | const workerData = { | |
dbca3be9 | 13 | function: TaskFunctions.jsonIntegerSerialization, |
e8114b23 | 14 | taskSize: 1000 |
cdace0e5 | 15 | } |
f1c674cd | 16 | |
cde5b54e JB |
17 | // FixedThreadPool |
18 | await 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 |
30 | await 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 | |
42 | await 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 | |
54 | await 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 | |
65 | exit() |