From d9f14be6275993cf4485db8a40a20730b1571a59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 19 Apr 2023 20:09:31 +0200 Subject: [PATCH] perf: add tasks queue to more benchmark MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/internal/bench.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/benchmarks/internal/bench.js b/benchmarks/internal/bench.js index d615f66e..4663d9c4 100644 --- a/benchmarks/internal/bench.js +++ b/benchmarks/internal/bench.js @@ -72,6 +72,13 @@ const fixedThreadPoolFairShare = buildPool( workerChoiceStrategyFairSharePoolOption ) +const fixedThreadPoolFairShareTasksQueue = buildPool( + WorkerTypes.THREAD, + PoolTypes.FIXED, + poolSize, + { ...workerChoiceStrategyFairSharePoolOption, ...tasksQueuePoolOption } +) + const dynamicThreadPoolRoundRobin = buildPool( WorkerTypes.THREAD, PoolTypes.DYNAMIC, @@ -149,6 +156,13 @@ const fixedClusterPoolFairShare = buildPool( workerChoiceStrategyFairSharePoolOption ) +const fixedClusterPoolFairShareTaskQueue = buildPool( + WorkerTypes.CLUSTER, + PoolTypes.FIXED, + poolSize, + { ...workerChoiceStrategyFairSharePoolOption, ...tasksQueuePoolOption } +) + const dynamicClusterPoolRoundRobin = buildPool( WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, @@ -228,6 +242,15 @@ Benchmark.suite( workerData }) }), + Benchmark.add( + 'Fixed:ThreadPool:FairShare:{ enableTasksQueue: true }', + async () => { + await runTest(fixedThreadPoolFairShareTasksQueue, { + taskExecutions, + workerData + }) + } + ), Benchmark.add('Dynamic:ThreadPool:RoundRobin', async () => { await runTest(dynamicThreadPoolRoundRobin, { taskExecutions, @@ -297,6 +320,15 @@ Benchmark.suite( workerData }) }), + Benchmark.add( + 'Fixed:ClusterPool:FairShare:{ enableTasksQueue: true }', + async () => { + await runTest(fixedClusterPoolFairShareTaskQueue, { + taskExecutions, + workerData + }) + } + ), Benchmark.add('Dynamic:ClusterPool:RoundRobin', async () => { await runTest(dynamicClusterPoolRoundRobin, { taskExecutions, -- 2.34.1