perf: add more possible configurations to continuous benchmarking
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 17 Sep 2023 11:38:33 +0000 (13:38 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 17 Sep 2023 11:38:33 +0000 (13:38 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
benchmarks/benchmarks-utils.mjs

index 2d553580c42e29491d8dc7efbfa4750482f1dc15..1d5ad24066d325b1a8ec37a84e4fc11f3de856c0 100644 (file)
@@ -7,6 +7,7 @@ import {
   DynamicThreadPool,
   FixedClusterPool,
   FixedThreadPool,
+  Measurements,
   PoolTypes,
   WorkerChoiceStrategies,
   WorkerTypes
@@ -93,24 +94,59 @@ export const runPoolifierPoolBenchmark = async (
         WorkerChoiceStrategies
       )) {
         for (const enableTasksQueue of [false, true]) {
-          suite.add(
-            `${name}|${workerChoiceStrategy}|${
-              enableTasksQueue ? 'with' : 'without'
-            } tasks queue`,
-            async () => {
-              pool.setWorkerChoiceStrategy(workerChoiceStrategy)
-              pool.enableTasksQueue(enableTasksQueue)
-              assert.strictEqual(
-                pool.opts.workerChoiceStrategy,
-                workerChoiceStrategy
+          if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
+            for (const measurement of [
+              Measurements.runTime,
+              Measurements.elu
+            ]) {
+              suite.add(
+                `${name}|${workerChoiceStrategy}|${measurement}|${
+                  enableTasksQueue ? 'with' : 'without'
+                } tasks queue`,
+                async () => {
+                  pool.setWorkerChoiceStrategy(workerChoiceStrategy, {
+                    measurement
+                  })
+                  pool.enableTasksQueue(enableTasksQueue)
+                  assert.strictEqual(
+                    pool.opts.workerChoiceStrategy,
+                    workerChoiceStrategy
+                  )
+                  assert.strictEqual(
+                    pool.opts.enableTasksQueue,
+                    enableTasksQueue
+                  )
+                  assert.strictEqual(
+                    pool.opts.workerChoiceStrategyOptions.measurement,
+                    measurement
+                  )
+                  await runPoolifierPool(pool, {
+                    taskExecutions,
+                    workerData
+                  })
+                }
               )
-              assert.strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
-              await runPoolifierPool(pool, {
-                taskExecutions,
-                workerData
-              })
             }
-          )
+          } else {
+            suite.add(
+              `${name}|${workerChoiceStrategy}|${
+                enableTasksQueue ? 'with' : 'without'
+              } tasks queue`,
+              async () => {
+                pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+                pool.enableTasksQueue(enableTasksQueue)
+                assert.strictEqual(
+                  pool.opts.workerChoiceStrategy,
+                  workerChoiceStrategy
+                )
+                assert.strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
+                await runPoolifierPool(pool, {
+                  taskExecutions,
+                  workerData
+                })
+              }
+            )
+          }
         }
       }
       suite