perf: measure missing browser load trace stages

Merged
LO
22d ago
+281-103

Adds measurement boundaries needed before ranking browser load optimizations: warm cache index/maps/spatial rebuilds and chunk decode; snapshot hydration/refusals; pool readiness and shard receipts; worker source installation and batch wasm/collection/posting. The existing styles.finalize span remains. The notes on reading these spans (per-chunk cache.chunkDecode spans are concurrent latencies, not a sum; deriving the lookup-end to pool-start gap) moved with the perf-ledger entry to #9673, so the ledger file no longer conflicts in the merge queue; this PR documents the span begin/end semantics in packages/load-trace/README.md. No added awaits, reordered operations or optimization.

Validation:

  • Passed: diff whitespace, production module-size ratchet (budgets unchanged), refwalk guards, and available pre-handoff gates (test wiring, CI coverage, license headers, silent revert and evidence guards).
  • Added a small worker tracing unit test for disabled behavior and synchronous sub-stage timings; NOT RUN locally (checkout has no node_modules).
  • Typecheck, relevant geometry/load-trace tests, focused viewer tests and viewer bundle ratchet are UNVERIFIED. Submitted final committed source through fleet with 24 GiB admission, 8 GiB Node heap, Turbo concurrency 1, explicit dependency installation, then those checks. Not waiting on queue to open this PR.
  • Pre-handoff SKIPPED source-text assertions/test teardown (missing TypeScript), workflow report paths (missing yaml), retained-free viewer (no dist). No full viewer suite or browser/model behavior run. No perf speedup claim.
  • Earlier request auto-97fe8ecc30e2477c8e285302e3c6f696 targets the first checkpoint and has an incorrect validation command (missing install and incorrect ratchet CLI); it is not acceptance evidence. Original receipt inspected; withdrawal refused with “no queued owner responded”; preserved original request and jobs. Final-source request is separate, not a replay of an uncertain execution.

Changeset added for load-trace and geometry. No issue; unqueued measurement-only work. Do not merge automatically.

Summary by CodeRabbit

  • New Features
    • Performance tracing now provides more detail on cache decoding, scene snapshot loading, geometry processing, worker readiness, and sharded prepass activity.
    • Trace data includes cache misses and counts of outbound transfer objects.
  • Documentation
    • Updated performance tracing guidance to explain the additional measurements and how to interpret chunk-decode timings.
  • Bug Fixes
    • Corrected sharded prepass trace reporting so completed spans are recorded before completion events are posted.