From 35553c4c1cde3bfc2ac8be90f605495fb632cfca Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 2 Dec 2025 13:18:48 +0100 Subject: [PATCH] fix(benchmarks): port to tinybench v6 API MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-utils.mjs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) 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 } } -- 2.43.0