From a2b1f8ecd74c68055a8a1b528e64e77d04aecf59 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 16 Feb 2026 09:46:31 -0800 Subject: [PATCH] Pad perf trace summary columns for stable markdown tables - define thread/title column widths as constants - pad thread IDs and titles so large-thread render rows align consistently --- scripts/desktop-perf-trace.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/desktop-perf-trace.mjs b/scripts/desktop-perf-trace.mjs index 26df93f4da..d83391cf56 100644 --- a/scripts/desktop-perf-trace.mjs +++ b/scripts/desktop-perf-trace.mjs @@ -203,12 +203,15 @@ function summarizeTrace(tracePath) { } function createMarkdownSummary({ tracePath, donePayload, summary, thresholds }) { + const THREAD_COL_WIDTH = 8; + const TITLE_COL_WIDTH = 15; + const pad = (value, width) => String(value).padEnd(width, " "); const largeThreadRenderStats = Array.isArray(donePayload.interactions?.largeThreadRenderStats) ? donePayload.interactions.largeThreadRenderStats : []; const formatThreadRenderRow = (stat) => { const threadShort = - typeof stat.threadId === "string" ? stat.threadId.slice(0, 8) : "n/a"; + typeof stat.threadId === "string" ? stat.threadId.slice(0, THREAD_COL_WIDTH) : "n/a"; const titleShort = typeof stat.threadTitleShort === "string" ? stat.threadTitleShort @@ -233,7 +236,7 @@ function createMarkdownSummary({ tracePath, donePayload, summary, thresholds }) typeof followUpMinMs === "number" && typeof followUpMaxMs === "number" ? `${followUpMinMs}-${followUpMaxMs} (${followUpSampleCount}x)` : "n/a"; - return `| ${threadShort} | ${titleShort} | ${stat.messageCount} | ${firstRenderMs} | ${followUpRenderMs} | ${followUpRange} | ${deltaMs} | ${deltaPct}% |`; + return `| ${pad(threadShort, THREAD_COL_WIDTH)} | ${pad(titleShort, TITLE_COL_WIDTH)} | ${stat.messageCount} | ${firstRenderMs} | ${followUpRenderMs} | ${followUpRange} | ${deltaMs} | ${deltaPct}% |`; }; const seedSource = donePayload.seed?.source === "file"