From a7825346645f0152334effb28bf0297c78fde2cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 16 Sep 2023 22:30:23 +0200 Subject: [PATCH] test: fix continuous benchmark pool implementation name MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-utils.mjs | 12 ++++++++++++ benchmarks/internal/bench.mjs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 98893f62..762966cf 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -78,6 +78,18 @@ export const runPoolifierTest = async ( }) } +export const getPoolImplementationName = pool => { + if (pool instanceof FixedThreadPool) { + return 'FixedThreadPool' + } else if (pool instanceof DynamicThreadPool) { + return 'DynamicThreadPool' + } else if (pool instanceof FixedClusterPool) { + return 'FixedClusterPool' + } else if (pool instanceof DynamicClusterPool) { + return 'DynamicClusterPool' + } +} + export const LIST_FORMATTER = new Intl.ListFormat('en-US', { style: 'long', type: 'conjunction' diff --git a/benchmarks/internal/bench.mjs b/benchmarks/internal/bench.mjs index c20b011f..1b71538d 100644 --- a/benchmarks/internal/bench.mjs +++ b/benchmarks/internal/bench.mjs @@ -10,6 +10,7 @@ import { TaskFunctions } from '../benchmarks-types.mjs' import { LIST_FORMATTER, buildPoolifierPool, + getPoolImplementationName, runPoolifierTest } from '../benchmarks-utils.mjs' @@ -32,7 +33,7 @@ for (const pool of [fixedThreadPool]) { for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) { for (const enableTasksQueue of [false, true]) { poolifierSuite.add( - `${pool.constructor.name}|${workerChoiceStrategy}|${ + `${getPoolImplementationName(pool)}|${workerChoiceStrategy}|${ enableTasksQueue ? 'with' : 'without' } tasks queue`, async () => { -- 2.34.1