Fix strategy handling in pool options (#259)
[poolifier.git] / benchmarks / internal / thread / fixed.js
CommitLineData
292ad316
JB
1const {
2 FixedThreadPool,
3 WorkerChoiceStrategies
4} = require('../../../lib/index')
74750c7f 5const { runPoolifierTest } = require('../benchmark-utils')
325f50bc
S
6
7const size = 30
e843b904 8const numberOfTasks = 1
325f50bc 9
ff5e76e1
JB
10const fixedPool = new FixedThreadPool(
11 size,
12 './benchmarks/internal/thread/worker.js'
13)
325f50bc 14
292ad316
JB
15const fixedPoolLessRecentlyUsed = new FixedThreadPool(
16 size,
17 './benchmarks/internal/thread/worker.js',
18 { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
19)
20
325f50bc 21async function fixedThreadTest (
e843b904 22 { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
325f50bc 23) {
74750c7f 24 return runPoolifierTest(fixedPool, { tasks, workerData })
325f50bc
S
25}
26
292ad316 27async function fixedThreadTestLessRecentlyUsed (
e843b904 28 { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
292ad316
JB
29) {
30 return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
31}
32
33module.exports = { fixedThreadTest, fixedThreadTestLessRecentlyUsed }