Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ci/llgo-size/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ time use separate commit matrices on the same page; each cell is ranked against
the other build modes for the same benchmark and commit, with smaller values
receiving the stronger favorable background. Matrix rows are visually grouped
by benchmark: the benchmark name appears once at the start of its build modes,
and a full-width separator marks the next benchmark.
and a full-width separator marks the next benchmark. The row set is the union
of every published run, so a historical benchmark remains visible with `—` in
commit columns where it was not produced.

The `llgo-main-updated` repository-dispatch event from `xgo-dev/llgo` first
updates `LLGO_COMMIT` on the benchmarks `main` branch, then explicitly starts a
Expand Down
12 changes: 10 additions & 2 deletions ci/llgo-size/site/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ function benchmarkMap(document) {
return new Map((document && document.benchmarks || []).map(function (item) { return [item.name, item]; }));
}

function benchmarkNamesFromDocuments(documents) {
const names = new Set();
documents.forEach(function (document) {
(document && document.benchmarks || []).forEach(function (benchmark) { names.add(benchmark.name); });
});
return Array.from(names).sort(function (a, b) { return a.localeCompare(b, undefined, { sensitivity: "base" }); });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ordering diverges from the server-generated TSV/summary.

This sorts names case-insensitively (localeCompare(..., { sensitivity: "base" })), but the server produces each run's benchmarks array via sort -u in report.sh:60 — a byte/locale sort that is case-sensitive under C/POSIX. For the mixed-case names this project uses (XGo, iXGo, Toml, Aws_restjson, ...), these orderings differ: e.g. iXGo sorts after all uppercase-initial names under sort -u but adjacent to XGo here. So the dashboard matrix rows (app.js:316) and the benchmark dropdown (app.js:578) will be ordered differently from the published total-bytes.tsv / summary.md, and differently from the previous code (which used the latest run's array order matching the TSV).

Consider matching sort -u (plain code-point comparison, or localeCompare without sensitivity: "base") if cross-referencing the dashboard against the raw TSV matters, or documenting the case-insensitive display order as intentional.

}

function parseBuildTimes(text) {
const lines = String(text || "").trim().split(/\r?\n/);
if (lines.length < 2) return new Map();
Expand Down Expand Up @@ -563,8 +571,8 @@ async function main() {
if (!response.ok) throw new Error("Cannot load the run index");
state.index = await response.json();
if (!state.index.runs || !state.index.runs.length) throw new Error("No benchmark runs are available");
const latest = await loadRun(state.index.runs[0]);
state.benchmarkNames = (latest.benchmarks || []).map(function (benchmark) { return benchmark.name; });
const documents = await Promise.all(state.index.runs.map(loadRun));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eager fetch of every historical run at startup blocks first paint.

This replaces the previous single-run fetch with a fan-out over runs.length documents, each doing fetch(..., { cache: "no-store" }) (plus a possible second legacy build-times fetch per run in loadLegacyBuildTimes). Cost is now O(N runs) and grows unbounded as history accumulates, and no-store defeats the HTTP cache so the full history re-downloads on every reload. This await sits on the critical path before attachEvents()/refreshAll(), so the UI stays non-interactive until all documents download and parse.

Deriving benchmark names doesn't require loading every run. Options, best first: (1) publish the benchmark-name list in data/index.json for O(1) startup; (2) seed names from the latest run as before and let renderTrend/chartRuns lazily load the rest (they already loadRun per meta); (3) at minimum drop cache: "no-store" for the immutable per-run documents so reloads hit cache.

state.benchmarkNames = benchmarkNamesFromDocuments(documents);
state.activeBenchmark = state.benchmarkNames[0] || "";
configs.forEach(function (config) { state.activeConfigs.add(config); });
dom.benchmarkSelect.innerHTML = state.benchmarkNames.map(function (name) { return '<option value="' + escapeHtml(name) + '">' + escapeHtml(name) + "</option>"; }).join("");
Expand Down