refactor: reorder pool builder helper arguments
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Apr 2023 22:07:05 +0000 (00:07 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 18 Apr 2023 22:07:05 +0000 (00:07 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
benchmarks/benchmarks-utils.js
benchmarks/internal/bench.js

index 64df58c87b4a3b1c671a73695ef5905cd195c6df..aac4b78583923252c0c8972273d7c8aced7f9842 100644 (file)
@@ -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) {
index 4c126a00fb9d531011b71cb52e459c2aa017b695..d615f66ea3d83a68c7b787e4ddb52395b1587b27 100644 (file)
@@ -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
 )