History

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

Julius Marminge committed 9 months ago

Commit a2b1f8e1 parent a4941ec1 file · +5 −2Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/desktop-perf-trace.mjs+5−2
@@ -203,12 +203,15 @@ function summarizeTrace(tracePath) { · 202 unmodified lines
203}203}
204 204
205function createMarkdownSummary({ tracePath, donePayload, summary, thresholds }) {205function createMarkdownSummary({ tracePath, donePayload, summary, thresholds }) {
206 const THREAD_COL_WIDTH = 8;
207 const TITLE_COL_WIDTH = 15;
208 const pad = (value, width) => String(value).padEnd(width, " ");
206 const largeThreadRenderStats = Array.isArray(donePayload.interactions?.largeThreadRenderStats)209 const largeThreadRenderStats = Array.isArray(donePayload.interactions?.largeThreadRenderStats)
207 ? donePayload.interactions.largeThreadRenderStats210 ? donePayload.interactions.largeThreadRenderStats
208 : [];211 : [];
209 const formatThreadRenderRow = (stat) => {212 const formatThreadRenderRow = (stat) => {
210 const threadShort =213 const threadShort =
211 typeof stat.threadId === "string" ? stat.threadId.slice(0, 8) : "n/a";214 typeof stat.threadId === "string" ? stat.threadId.slice(0, THREAD_COL_WIDTH) : "n/a";
212 const titleShort =215 const titleShort =
213 typeof stat.threadTitleShort === "string"216 typeof stat.threadTitleShort === "string"
214 ? stat.threadTitleShort217 ? stat.threadTitleShort
@@ -233,7 +236,7 @@ function createMarkdownSummary({ tracePath, donePayload, summary, thresholds }) · 18 unmodified lines
233 typeof followUpMinMs === "number" && typeof followUpMaxMs === "number"236 typeof followUpMinMs === "number" && typeof followUpMaxMs === "number"
234 ? `${followUpMinMs}-${followUpMaxMs} (${followUpSampleCount}x)`237 ? `${followUpMinMs}-${followUpMaxMs} (${followUpSampleCount}x)`
235 : "n/a";238 : "n/a";
236 return `| ${threadShort} | ${titleShort} | ${stat.messageCount} | ${firstRenderMs} | ${followUpRenderMs} | ${followUpRange} | ${deltaMs} | ${deltaPct}% |`;239 return `| ${pad(threadShort, THREAD_COL_WIDTH)} | ${pad(titleShort, TITLE_COL_WIDTH)} | ${stat.messageCount} | ${firstRenderMs} | ${followUpRenderMs} | ${followUpRange} | ${deltaMs} | ${deltaPct}% |`;
237 };240 };
238 const seedSource =241 const seedSource =
239 donePayload.seed?.source === "file"242 donePayload.seed?.source === "file"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t