Commit | Line | Data |
---|---|---|
ff5e76e1 JB |
1 | const { |
2 | DynamicClusterPool, | |
3 | WorkerChoiceStrategies | |
4 | } = require('../../../lib/index') | |
74750c7f | 5 | const { runPoolifierTest } = require('../benchmark-utils') |
325f50bc S |
6 | |
7 | const size = 30 | |
e843b904 | 8 | const numberOfTasks = 1 |
325f50bc S |
9 | |
10 | const dynamicPool = new DynamicClusterPool( | |
11 | size / 2, | |
12 | size * 3, | |
1927ee67 | 13 | './benchmarks/internal/cluster/worker.js' |
325f50bc S |
14 | ) |
15 | ||
ff5e76e1 JB |
16 | const dynamicPoolLessRecentlyUsed = new DynamicClusterPool( |
17 | size / 2, | |
18 | size * 3, | |
19 | './benchmarks/internal/cluster/worker.js', | |
20 | { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } | |
21 | ) | |
22 | ||
325f50bc | 23 | async function dynamicClusterTest ( |
e843b904 | 24 | { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } |
325f50bc | 25 | ) { |
74750c7f | 26 | return runPoolifierTest(dynamicPool, { tasks, workerData }) |
325f50bc S |
27 | } |
28 | ||
ff5e76e1 | 29 | async function dynamicClusterTestLessRecentlyUsed ( |
e843b904 | 30 | { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } |
ff5e76e1 | 31 | ) { |
74750c7f | 32 | return runPoolifierTest(dynamicPoolLessRecentlyUsed, { tasks, workerData }) |
ff5e76e1 JB |
33 | } |
34 | ||
35 | module.exports = { | |
36 | dynamicClusterTest, | |
37 | dynamicClusterTestLessRecentlyUsed | |
38 | } |