From 42bb4cddc23d9166f4213068f9475a9ea332b203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 23 Jul 2025 16:57:12 +0100 Subject: [PATCH] Truncate "meanCount" and "stdCount" results --- packages/measure/src/__tests__/measure-helpers.test.ts | 8 ++++---- packages/measure/src/measure-helpers.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/measure/src/__tests__/measure-helpers.test.ts b/packages/measure/src/__tests__/measure-helpers.test.ts index b5768188a..c2b7e4259 100644 --- a/packages/measure/src/__tests__/measure-helpers.test.ts +++ b/packages/measure/src/__tests__/measure-helpers.test.ts @@ -3,7 +3,7 @@ import { processRunResults } from '../measure-helpers'; test('processRunResults calculates correct means and stdevs', () => { const input = [ { duration: 10, count: 2 }, - { duration: 12, count: 2 }, + { duration: 12, count: 3 }, { duration: 14, count: 2 }, ]; @@ -11,7 +11,7 @@ test('processRunResults calculates correct means and stdevs', () => { { "counts": [ 2, - 2, + 3, 2, ], "durations": [ @@ -34,7 +34,7 @@ test('processRunResults applies warmupRuns option', () => { const input = [ { duration: 23, count: 1 }, { duration: 20, count: 5 }, - { duration: 24, count: 5 }, + { duration: 24, count: 6 }, { duration: 22, count: 5 }, ]; @@ -42,7 +42,7 @@ test('processRunResults applies warmupRuns option', () => { { "counts": [ 5, - 5, + 6, 5, ], "durations": [ diff --git a/packages/measure/src/measure-helpers.tsx b/packages/measure/src/measure-helpers.tsx index 741a9030c..5cbb342e1 100644 --- a/packages/measure/src/measure-helpers.tsx +++ b/packages/measure/src/measure-helpers.tsx @@ -26,8 +26,8 @@ export function processRunResults(inputResults: RunResult[], options: ProcessRun const outlierDurations = outliers?.map((result) => result.duration); const counts = runResults.map((result) => result.count); - const meanCount = math.mean(...counts) as number; - const stdevCount = math.std(...counts); + const meanCount = math.fix(math.mean(...counts)) as number; + const stdevCount = math.fix(math.std(...counts)); return { runs: runResults.length,