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