]> Piment Noir Git Repositories - poolifier.git/commitdiff
fix(benchmarks): port to tinybench v6 API
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 2 Dec 2025 12:18:48 +0000 (13:18 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 2 Dec 2025 12:18:48 +0000 (13:18 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
benchmarks/benchmarks-utils.mjs

index d0500928b4e5d6faf183a119575ebefe838420d3..83013e6760ea3ac5394634c4caf285d26303ae46 100644 (file)
@@ -65,6 +65,7 @@ export const runPoolifierBenchmarkTinyBench = async (
   poolSize,
   { taskExecutions, workerData }
 ) => {
+  const bmfResults = {}
   try {
     const bench = new Bench()
     const pool = buildPoolifierPool(workerType, poolType, poolSize)
@@ -137,24 +138,31 @@ export const runPoolifierBenchmarkTinyBench = async (
     console.table(bench.table())
     await pool.destroy()
 
-    const bmfResults = {}
     for (const task of tasks) {
-      bmfResults[task.name] = {
-        latency: {
-          lower_value: task.result.latency.mean - task.result.latency.sd,
-          upper_value: task.result.latency.mean + task.result.latency.sd,
-          value: task.result.latency.mean,
-        },
-        throughput: {
-          lower_value: task.result.throughput.mean - task.result.throughput.sd,
-          upper_value: task.result.throughput.mean + task.result.throughput.sd,
-          value: task.result.throughput.mean,
-        },
+      if (
+        task.result?.state === 'completed' ||
+        task.result?.state === 'aborted-with-statistics'
+      ) {
+        bmfResults[task.name] = {
+          latency: {
+            lower_value: task.result.latency.mean - task.result.latency.sd,
+            upper_value: task.result.latency.mean + task.result.latency.sd,
+            value: task.result.latency.mean,
+          },
+          throughput: {
+            lower_value:
+              task.result.throughput.mean - task.result.throughput.sd,
+            upper_value:
+              task.result.throughput.mean + task.result.throughput.sd,
+            value: task.result.throughput.mean,
+          },
+        }
       }
     }
     return bmfResults
   } catch (error) {
     console.error(error)
+    return bmfResults
   }
 }