Commit | Line | Data |
---|---|---|
d09b37fc | 1 | import { |
d9d8c14e | 2 | PoolTypes, |
d9d8c14e | 3 | WorkerTypes, |
d09b37fc JB |
4 | availableParallelism |
5 | } from '../../lib/index.mjs' | |
dbca3be9 | 6 | import { TaskFunctions } from '../benchmarks-types.mjs' |
f1c674cd | 7 | import { |
f1c674cd | 8 | buildPoolifierPool, |
cde5b54e | 9 | runPoolifierPoolBenchmark |
f1c674cd | 10 | } from '../benchmarks-utils.mjs' |
cdace0e5 | 11 | |
d09b37fc | 12 | const poolSize = availableParallelism() |
cdace0e5 JB |
13 | const taskExecutions = 1 |
14 | const workerData = { | |
dbca3be9 | 15 | function: TaskFunctions.jsonIntegerSerialization, |
e8114b23 | 16 | taskSize: 1000 |
cdace0e5 | 17 | } |
f1c674cd | 18 | |
cde5b54e JB |
19 | // FixedThreadPool |
20 | await 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 |
30 | await runPoolifierPoolBenchmark( | |
31 | 'Poolifier DynamicThreadPool', | |
32 | buildPoolifierPool(WorkerTypes.thread, PoolTypes.dynamic, poolSize), | |
33 | { | |
34 | taskExecutions, | |
35 | workerData | |
36 | } | |
37 | ) |