4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../../benchmarks-utils')
8 const numberOfTasks
= 1
10 const fixedPool
= new FixedThreadPool(
12 './benchmarks/internal/thread/worker.js'
15 const fixedPoolLessRecentlyUsed
= new FixedThreadPool(
17 './benchmarks/internal/thread/worker.js',
18 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_RECENTLY_USED
}
21 const fixedPoolWeightedRoundRobin
= new FixedThreadPool(
23 './benchmarks/internal/thread/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
27 const fixedPoolFairShare
= new FixedThreadPool(
29 './benchmarks/internal/thread/worker.js',
30 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
33 async
function fixedThreadTest (
34 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
36 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
39 async
function fixedThreadTestLessRecentlyUsed (
40 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
42 return runPoolifierTest(fixedPoolLessRecentlyUsed
, { tasks
, workerData
})
45 async
function fixedThreadTestWeightedRoundRobin (
46 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
48 return runPoolifierTest(fixedPoolWeightedRoundRobin
, { tasks
, workerData
})
51 async
function fixedThreadTestFairShare (
52 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
54 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
59 fixedThreadTestLessRecentlyUsed
,
60 fixedThreadTestWeightedRoundRobin
,
61 fixedThreadTestFairShare