Bump typedoc from 0.20.29 to 0.20.30 (#256)
[poolifier.git] / benchmarks / internal / cluster / dynamic.js
CommitLineData
ff5e76e1
JB
1const {
2 DynamicClusterPool,
3 WorkerChoiceStrategies
4} = require('../../../lib/index')
5const { runTest } = require('../benchmark-utils')
325f50bc
S
6
7const size = 30
8
9const dynamicPool = new DynamicClusterPool(
10 size / 2,
11 size * 3,
1927ee67 12 './benchmarks/internal/cluster/worker.js'
325f50bc
S
13)
14
ff5e76e1
JB
15const dynamicPoolLessRecentlyUsed = new DynamicClusterPool(
16 size / 2,
17 size * 3,
18 './benchmarks/internal/cluster/worker.js',
19 { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
20)
21
325f50bc
S
22async function dynamicClusterTest (
23 { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } }
24) {
ff5e76e1 25 return runTest(dynamicPool, { tasks, workerData })
325f50bc
S
26}
27
ff5e76e1
JB
28async function dynamicClusterTestLessRecentlyUsed (
29 { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } }
30) {
31 return runTest(dynamicPoolLessRecentlyUsed, { tasks, workerData })
32}
33
34module.exports = {
35 dynamicClusterTest,
36 dynamicClusterTestLessRecentlyUsed
37}