test(benchmarks): compare on anon memory, retry pre-hydration login clicks

Two fixes found by running the harness against a real pair of images:

Login submitted before the form hydrated, so the click was a no-op that
looked identical to bad credentials. Load the page at networkidle and
retry the submit, surfacing any page alert if all attempts fail — the
same race already handled for the onboarding restore toggle.

memory.current counts reclaimable page cache, which moved the "same"
baseline between 192 and 261 MiB across runs. Anonymous memory is now
the headline metric (idle was 144 MiB anon vs 77 MiB of page cache), so
an A/B is not decided by unrelated disk I/O.
This commit is contained in:
Thomas Camlong committed 2026-08-09 00:44:50 +02:00
1 parent 6363d96a1b
commit fb80b3882d
3 files changed
+67 -18

No files matched your search

+15 -2
View File
@@ -139,9 +139,15 @@ export const summarizeStress = (checkpoints: StressCheckpoint[], soakPrefix = "s
const checkpoint = checkpoints.find((candidate) => candidate.name === name);
return checkpoint ? toMiB(checkpoint.container.currentBytes) : null;
};
// Anonymous memory is the number to compare across runs: memory.current also
// counts reclaimable page cache, which swings tens of MiB with unrelated disk I/O.
const anonMiBByName = (name: string) => {
const checkpoint = checkpoints.find((candidate) => candidate.name === name);
return checkpoint ? toMiB(checkpoint.container.anonymousBytes) : null;
};
const soakSamples = checkpoints
.filter((checkpoint) => checkpoint.name.startsWith(soakPrefix))
.map((checkpoint) => ({ elapsedMs: checkpoint.elapsedMs, bytes: checkpoint.container.currentBytes }));
.map((checkpoint) => ({ elapsedMs: checkpoint.elapsedMs, bytes: checkpoint.container.anonymousBytes }));
const peak = checkpoints.reduce(
(max, checkpoint) => Math.max(max, checkpoint.container.peakBytes ?? checkpoint.container.currentBytes),
@@ -156,12 +162,19 @@ export const summarizeStress = (checkpoints: StressCheckpoint[], soakPrefix = "s
nodeRssMiB: Object.fromEntries(
checkpoints.map((checkpoint) => [checkpoint.name, toMiB(sumNodeRssBytes(checkpoint))]),
),
anonMiB: Object.fromEntries(
checkpoints.map((checkpoint) => [checkpoint.name, toMiB(checkpoint.container.anonymousBytes)]),
),
// Primary comparison metric: anonymous (non-reclaimable) memory.
headline: {
bootIdleAnonMiB: anonMiBByName("01-boot-idle"),
boardLoadedAnonMiB: anonMiBByName("04-board-loaded"),
afterStressAnonMiB: anonMiBByName("05-after-stress"),
bootIdleMiB: containerMiBByName("01-boot-idle"),
boardLoadedMiB: containerMiBByName("04-board-loaded"),
afterStressMiB: containerMiBByName("05-after-stress"),
peakMiB: toMiB(peak),
soakGrowthMiBPerHour: (() => {
soakAnonGrowthMiBPerHour: (() => {
const slope = getGrowthBytesPerHour(soakSamples);
return slope === null ? null : toMiB(slope);
})(),