X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fcluster%2Ffixed.js;h=fc4cc3ac8dc545ba4b8d530401b19ac396f1f02c;hb=9beb6c8fae8263582479c18d9f4bc2520efe9280;hp=62c19aabf87fad362973abff99f2f390a8015712;hpb=74750c7f0a8b83b3a579f4d7fc96070ca540b234;p=poolifier.git diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index 62c19aab..fc4cc3ac 100644 --- a/benchmarks/internal/cluster/fixed.js +++ b/benchmarks/internal/cluster/fixed.js @@ -1,17 +1,33 @@ -const { FixedClusterPool } = require('../../../lib/index') +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 }) } -module.exports = { fixedClusterTest } +async function fixedClusterTestLessRecentlyUsed ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) +} + +module.exports = { fixedClusterTest, fixedClusterTestLessRecentlyUsed }