X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Ffixed.js;h=fc4cc3ac8dc545ba4b8d530401b19ac396f1f02c;hb=4edc4c1690134933db8cf9d97c926769a1972c7c;hp=60a5b938f8a5a6f46fc474a1e0e115152dba05e0;hpb=ff5e76e152be8540cba8118bb4e2b9da314dfff5;p=poolifier.git diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index 60a5b938..fc4cc3ac 100644 --- a/benchmarks/internal/cluster/fixed.js +++ b/benchmarks/internal/cluster/fixed.js @@ -1,17 +1,33 @@ -const { FixedClusterPool } = require('../../../lib/index') -const { runTest } = require('../benchmark-utils') +const { + FixedClusterPool, + WorkerChoiceStrategies +} = require('../../../lib/index') +const { runPoolifierTest } = require('../benchmark-utils') const size = 30 +const numberOfTasks = 1 const fixedPool = new FixedClusterPool( size, './benchmarks/internal/cluster/worker.js' ) +const fixedPoolLessRecentlyUsed = new FixedClusterPool( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } +) + async function fixedClusterTest ( - { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPool, { tasks, workerData }) +} + +async function fixedClusterTestLessRecentlyUsed ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { - return runTest(fixedPool, { tasks, workerData }) + return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) } -module.exports = { fixedClusterTest } +module.exports = { fixedClusterTest, fixedClusterTestLessRecentlyUsed }