From: Jérôme Benoit Date: Tue, 18 Apr 2023 22:07:05 +0000 (+0200) Subject: refactor: reorder pool builder helper arguments X-Git-Tag: v2.4.11~25 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1f29c16f4e4eb928115b9cd0cad8d655e1580cc3;p=poolifier.git refactor: reorder pool builder helper arguments Signed-off-by: Jérôme Benoit --- diff --git a/benchmarks/benchmarks-utils.js b/benchmarks/benchmarks-utils.js index 64df58c8..aac4b785 100644 --- a/benchmarks/benchmarks-utils.js +++ b/benchmarks/benchmarks-utils.js @@ -56,7 +56,6 @@ function jsonIntegerSerialization (n) { /** * Intentionally inefficient implementation. - * * @param {number} n - The number of fibonacci numbers to generate. * @returns {number} - The nth fibonacci number. */ @@ -67,7 +66,6 @@ function fibonacci (n) { /** * Intentionally inefficient implementation. - * * @param {number} n - The number to calculate the factorial of. * @returns {number} - The factorial of n. */ @@ -114,7 +112,7 @@ function executeWorkerFunction (data) { } } -function buildPool (poolType, poolSize, workerType, poolOptions) { +function buildPool (workerType, poolType, poolSize, poolOptions) { switch (poolType) { case PoolTypes.FIXED: switch (workerType) { diff --git a/benchmarks/internal/bench.js b/benchmarks/internal/bench.js index 4c126a00..d615f66e 100644 --- a/benchmarks/internal/bench.js +++ b/benchmarks/internal/bench.js @@ -31,156 +31,156 @@ const workerChoiceStrategyFairSharePoolOption = { } const fixedThreadPoolRoundRobin = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyRoundRobinPoolOption ) const fixedThreadPoolRoundRobinTasksQueue = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) const fixedThreadPoolLessUsed = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyLessUsedPoolOption ) const fixedThreadPoolLessBusy = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyLessBusyPoolOption ) const fixedThreadPoolWeightedRoundRobin = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyWeightedRoundRobinPoolOption ) const fixedThreadPoolFairShare = buildPool( + WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyFairSharePoolOption ) const dynamicThreadPoolRoundRobin = buildPool( + WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyRoundRobinPoolOption ) const dynamicThreadPoolLessUsed = buildPool( + WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyLessUsedPoolOption ) const dynamicThreadPoolLessBusy = buildPool( + WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyLessBusyPoolOption ) const dynamicThreadPoolWeightedRoundRobin = buildPool( + WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyWeightedRoundRobinPoolOption ) const dynamicThreadPoolFairShare = buildPool( + WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.THREAD, workerChoiceStrategyFairSharePoolOption ) const fixedClusterPoolRoundRobin = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyRoundRobinPoolOption ) const fixedClusterPoolRoundRobinTasksQueue = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) const fixedClusterPoolLessUsed = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyLessUsedPoolOption ) const fixedClusterPoolLessBusy = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyLessBusyPoolOption ) const fixedClusterPoolWeightedRoundRobin = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyWeightedRoundRobinPoolOption ) const fixedClusterPoolFairShare = buildPool( + WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyFairSharePoolOption ) const dynamicClusterPoolRoundRobin = buildPool( + WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyRoundRobinPoolOption ) const dynamicClusterPoolLessUsed = buildPool( + WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyLessUsedPoolOption ) const dynamicClusterPoolLessBusy = buildPool( + WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyLessBusyPoolOption ) const dynamicClusterPoolWeightedRoundRobin = buildPool( + WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyWeightedRoundRobinPoolOption ) const dynamicClusterPoolFairShare = buildPool( + WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - WorkerTypes.CLUSTER, workerChoiceStrategyFairSharePoolOption )