From 812b5fbf0b8eabe749ba9d72c3883a8c202f23db Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 27 Jun 2026 19:57:48 +0900 Subject: [PATCH] Update frontend-browser-report.mts --- .github/scripts/frontend-browser-report.mts | 39 ++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/scripts/frontend-browser-report.mts b/.github/scripts/frontend-browser-report.mts index 2d421e9a5d..4b781df090 100644 --- a/.github/scripts/frontend-browser-report.mts +++ b/.github/scripts/frontend-browser-report.mts @@ -102,9 +102,9 @@ function formatSecondsAsMs(value: number | null | undefined) { return formatMs(value * 1_000); } -function formatDelta(value: number, formatter: (value: number) => string) { - if (value === 0) return formatter(0); - return util.formatColoredDelta(formatter(Math.abs(value)), value); +function formatDelta(delta: number, formatter: (value: number) => string, colorThreshold = 0) { + if (delta === 0) return formatter(0); + return util.formatColoredDelta(delta, v => formatter(v), colorThreshold); } function finiteValues(values: (number | null | undefined)[]) { @@ -213,14 +213,37 @@ function renderResourceTypeTable(base: BrowserMetricsReport, head: BrowserMetric ])].filter(key => base.summary.network.byResourceType[key] != null || head.summary.network.byResourceType[key] != null); const lines = [ - '| Type | Base reqs | Head reqs | Δ reqs | Base encoded | Head encoded | Δ encoded |', - '| --- | ---: | ---: | ---: | ---: | ---: | ---: |', + '
| Type | ', + 'Requests | ', + 'Encoded bytes | ', + '||||
|---|---|---|---|---|---|---|
| Base | ', + 'Head | ', + 'Δ | ', + 'Base | ', + 'Head | ', + 'Δ | ', + '|
| ${key} | `); + lines.push(`${util.formatNumber(baseRow.requests)} | `); + lines.push(`${util.formatNumber(headRow.requests)} | `); + lines.push(`${formatDelta(headRow.requests - baseRow.requests, util.formatNumber)} | `); + lines.push(`${util.formatBytes(baseRow.encodedBytes)} | `); + lines.push(`${util.formatBytes(headRow.encodedBytes)} | `); + lines.push(`${formatDelta(headRow.encodedBytes - baseRow.encodedBytes, util.formatBytes)} | `); + lines.push('