From: Jérôme Benoit Date: Tue, 2 Dec 2025 12:18:48 +0000 (+0100) Subject: fix(benchmarks): port to tinybench v6 API X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=35553c4c1cde3bfc2ac8be90f605495fb632cfca;p=poolifier.git fix(benchmarks): port to tinybench v6 API Signed-off-by: Jérôme Benoit --- diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index d0500928b..83013e676 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -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 } }