X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=benchmarks%2Finternal%2Fcluster%2Ffixed.js;h=69e4a14870013bd5f3136d8ecb25309c9d93c163;hb=168c526f6e6913506e56f7d5107335c3d3d42938;hp=548ed9f9eb1518a697069ee8d5cd68a6a2f61830;hpb=23ff945ac0bc3b9bcf98c6491872cffaac805b73;p=poolifier.git diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index 548ed9f9..69e4a148 100644 --- a/benchmarks/internal/cluster/fixed.js +++ b/benchmarks/internal/cluster/fixed.js @@ -2,7 +2,7 @@ const { FixedClusterPool, WorkerChoiceStrategies } = require('../../../lib/index') -const { runPoolifierTest } = require('../benchmark-utils') +const { runPoolifierTest } = require('../../benchmarks-utils') const size = 30 const numberOfTasks = 1 @@ -12,10 +12,16 @@ const fixedPool = new FixedClusterPool( './benchmarks/internal/cluster/worker.js' ) -const fixedPoolLessRecentlyUsed = new FixedClusterPool( +const fixedPoolLessUsed = new FixedClusterPool( size, './benchmarks/internal/cluster/worker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED } +) + +const fixedPoolWeightedRoundRobin = new FixedClusterPool( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN } ) const fixedPoolFairShare = new FixedClusterPool( @@ -30,10 +36,16 @@ async function fixedClusterTest ( return runPoolifierTest(fixedPool, { tasks, workerData }) } -async function fixedClusterTestLessRecentlyUsed ( +async function fixedClusterTestLessUsed ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolLessUsed, { tasks, workerData }) +} + +async function fixedClusterTestWeightedRoundRobin ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { - return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) + return runPoolifierTest(fixedPoolWeightedRoundRobin, { tasks, workerData }) } async function fixedClusterTestFairShare ( @@ -44,6 +56,7 @@ async function fixedClusterTestFairShare ( module.exports = { fixedClusterTest, - fixedClusterTestFairShare, - fixedClusterTestLessRecentlyUsed + fixedClusterTestLessUsed, + fixedClusterTestWeightedRoundRobin, + fixedClusterTestFairShare }