X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Finternal%2Fthread%2Ffixed.js;h=a4ba580e0210710915e184abaeb6951caf1c6fd2;hb=765457872257684691f93befb94175a2aaa83502;hp=376352376d4bbb3f4636d2dc4baca2cdeaf91ba2;hpb=2d401b2d21b1d9225c9168f85e32234353feb0c3;p=poolifier.git diff --git a/benchmarks/internal/thread/fixed.js b/benchmarks/internal/thread/fixed.js index 37635237..a4ba580e 100644 --- a/benchmarks/internal/thread/fixed.js +++ b/benchmarks/internal/thread/fixed.js @@ -2,7 +2,7 @@ const { FixedThreadPool, 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 FixedThreadPool( './benchmarks/internal/thread/worker.js' ) -const fixedPoolLessRecentlyUsed = new FixedThreadPool( +const fixedPoolLessUsed = new FixedThreadPool( size, './benchmarks/internal/thread/worker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED } +) + +const fixedPoolLessBusy = new FixedThreadPool( + size, + './benchmarks/internal/thread/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY } ) const fixedPoolWeightedRoundRobin = new FixedThreadPool( @@ -36,10 +42,16 @@ async function fixedThreadTest ( return runPoolifierTest(fixedPool, { tasks, workerData }) } -async function fixedThreadTestLessRecentlyUsed ( +async function fixedThreadTestLessUsed ( + { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolLessUsed, { tasks, workerData }) +} + +async function fixedThreadTestLessBusy ( { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } } ) { - return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) + return runPoolifierTest(fixedPoolLessBusy, { tasks, workerData }) } async function fixedThreadTestWeightedRoundRobin ( @@ -56,7 +68,8 @@ async function fixedThreadTestFairShare ( module.exports = { fixedThreadTest, - fixedThreadTestLessRecentlyUsed, + fixedThreadTestLessUsed, + fixedThreadTestLessBusy, fixedThreadTestWeightedRoundRobin, fixedThreadTestFairShare }