Commit | Line | Data |
---|---|---|
292ad316 JB |
1 | const { |
2 | FixedThreadPool, | |
3 | WorkerChoiceStrategies | |
4 | } = require('../../../lib/index') | |
74750c7f | 5 | const { runPoolifierTest } = require('../benchmark-utils') |
325f50bc S |
6 | |
7 | const size = 30 | |
8 | ||
ff5e76e1 JB |
9 | const fixedPool = new FixedThreadPool( |
10 | size, | |
11 | './benchmarks/internal/thread/worker.js' | |
12 | ) | |
325f50bc | 13 | |
292ad316 JB |
14 | const fixedPoolLessRecentlyUsed = new FixedThreadPool( |
15 | size, | |
16 | './benchmarks/internal/thread/worker.js', | |
17 | { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } | |
18 | ) | |
19 | ||
325f50bc S |
20 | async function fixedThreadTest ( |
21 | { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } | |
22 | ) { | |
74750c7f | 23 | return runPoolifierTest(fixedPool, { tasks, workerData }) |
325f50bc S |
24 | } |
25 | ||
292ad316 JB |
26 | async function fixedThreadTestLessRecentlyUsed ( |
27 | { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } | |
28 | ) { | |
29 | return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) | |
30 | } | |
31 | ||
32 | module.exports = { fixedThreadTest, fixedThreadTestLessRecentlyUsed } |