perf(scripts): load-time scoreboard (native + browser lanes, A/A noise floor verdicts)

Merged
LO
20d ago
+1950-127

What

scripts/perf/load-scoreboard.mjs: one scoreboard for IFC load time, so load optimisations can be accepted or rejected from a single table. For each fixture and lane (native-cold, browser-cold, browser-warm) it reports:

  • time to first geometry
  • time to fully interactive
  • peak memory
  • per-stage share of the total
  • median and spread over samples
  • output fingerprints
  • a base-vs-branch verdict

It compiles nothing and reuses existing tools:

  • native-cold: one fresh perf_probe --cold --iters 1 --fingerprint process per sample. Peak RSS comes from /usr/bin/time. The probe's stages sum exactly to the full load. The native pipeline is a batch call, so it has no first-geometry time. Native has no warm lane, because no native cache exists outside apps/server.
  • browser-cold / browser-warm: one fresh Chrome with an empty profile per sample. The cold open runs first, then two reopens: the first streams the cache hit and writes the scene snapshot, the second adopts it. The launch is the same as scenoptic-bench (headed on a private Xvfb, NVIDIA ICD), plus --use-webgpu-power-preference=default-high-performance (#8787). Each sample records the WebGPU adapter, a GPU-health check (tests/benchmark/gpu-health.ts), crashes and page errors. Peak memory is the peak sampled PSS of the profile's Chrome processes, with per-process VmHWM kept beside it. Stage shares come from ?perfTrace=1 spans.
  • Readiness moves out of scenoptic-bench.mjs into viewer-load-probe.mjs, so both tools stop the timer at the same point. It follows the README's cold-load validation notes: geometry drained and finalized, metadata ready and the store settled. The store's settle transition is now captured by a subscription armed before the input event, rather than read from the 100 ms poll.
  • Verdict: gain = 1 - median(branch)/median(base). The noise floor is the larger of the recorded A/A floor and the run's own floor. The run's own floor (ownNoiseFloor) is one robust standard deviation (interquartile range / 1.349) of each side's relative scatter and of the paired per-round differences. The paired-bootstrap half-width is still computed and reported, but only as information; it is not part of the floor. A change counts only when |gain| >= 2x the floor and there are at least 5 successful samples per side. A branch with more failed loads than the base is a regression. Rounds use ab-order.mjs's balanced randomized first-side order.

Each sample row states the cache tier the fixture was expected to hit and the tier it actually hit, so cases where warm equals cold are explicit.

Evidence

  • node --test scripts/perf/load-scoreboard-stats.test.mjs covers the decision rule: the A/A case, a 30% regression, a gain blocked by the A/A floor, the resolution floor, failure handling, interval union and native stage accounting. scripts/perf/*.test.mjs passes in full (28 scoreboard tests in load-scoreboard-stats.test.mjs and load-scoreboard-cli.test.mjs, the latter driving load-scoreboard.mjs report end to end). The revert oracle reports OBSERVED: each test loads its module itself, so a revert fails assertions instead of breaking imports.
  • node scripts/pre-handoff.mjs passes. retained-free viewer was SKIPPED: no viewer dist in this checkout, and no viewer source changed.
  • Untimed smoke runs on Pop exercised both lanes end to end: browser cold, warm with a cache write and snapshot adoption, matching fingerprints, and a native sample with RAYON_NUM_THREADS.
  • Output identity is partition-independent. The browser fingerprint is the per-element Rust geometry hash (#924, taken before flat/instanced routing), combined over flat meshes and instancedGeometryHashes. Batch-local instancing moves elements between flat meshes and IFNS shards with the batch partition, so the first version's flat-only counts varied between identical builds. Warm (cache-hit) opens carry no hashes, so they inherit their cold load's identity only when they restored its flat output exactly. Otherwise they report unverifiable. Untimed checks on Pop:
    • A/A copies, 7 fixtures, cold and warm: identical per element.
    • ?geomWorkers=2 vs the default: identical, although skolebygg's flat split moved (12,419 vs 12,349 meshes).
    • ?geomTier=lowest: DIFFERS on 828 of 5,555 skolebygg elements and 881 of 6,650 advanced_model elements.
  • Timing corrections, made after untimed quiet-host diagnostics showed that the first dry run was mostly host load plus harness artefacts:
    • Each open is armed after the shell has gone 1 s without a long task, and is timed from the input's change event. The input delay is reported and flagged.
    • Interactive ends at the first frame after the store settles. The publish frame and a UI-quiet time are reported beside it.
    • The page's perf counters are off during timed opens, which removes the main-thread worker-message byte walk.
    • Peak memory comes from a separate pass, because the PSS sampler cost about 12% when it ran inside timed opens.
    • Uncached fixtures skip the snapshot wait.
    • The first reopen gets its own lane, browser-warm1.
    • Each sample records host CPU pressure and any build processes.
    • Fewer than 3 values are never shown as a median. A verdict needs 5 samples per side.
    • The run's own noise floor is interquartile (IQR / 1.349), chosen on the timed A/A below. A 3-round A/A had shown a false 10% gain against a collapsed 3% bootstrap floor. In the timed A/A, one outlier made a range-based floor 37% and the 5-round bootstrap 21%, which hid a consistent +37% regression. A MAD-based floor read bimodal metrics as differences between identical builds.
  • Timed baseline (exclusive benchmark job c88e33aa, main@004934fa88 against a byte-identical copy, 7 fixtures, 4 lanes, 5 interleaved rounds, 430 samples, 0 failed loads). Re-rendered from the raw samples with the final rule:
    • A/A: every lane's interactive verdict is no significant difference (28/28), and 97 of 98 cells overall. The one exception is FZK first-reopen, a consistent 5.6% difference between the two copies that its A/A floor records.
    • Known regressions: RAYON_NUM_THREADS=2 is flagged in native-cold on 3/3 fixtures, and ?geomWorkers=1 in browser-cold on 3/3. ?perf.sceneSnapshot=0 is flagged on the snapshot reopen where adoption beats a streamed hit (advanced_model, +37%). The cold control stays quiet.
    • Output: per-element output matched in every sample.
    • Snapshot-timeout check: every expected snapshot reopen adopted its snapshot, so a snapshot-write timeout affected no sample.

No product code changed. Not a CI gate.

šŸ¤– Generated with Claude Code