perf(harness): add 2D-highway frame-time measurement + capture the R3c gate (H0)#848
Conversation
…c gate (H0) scripts/perf-baseline.mjs gains a `--song` mode: it wraps requestAnimationFrame before any page script, TAGS the frames the highway actually painted (via highway.addDrawHook), starts playback, and reports draw-frame p50/p95/p99 over `--frames` seconds across `--runs` runs. Tagging is the point — ~half the rAF callbacks are other cheap loops (~0.1 ms); averaging them in would hide a renderer regression, so only draw frames are counted. This is the metric the plan says gates the highway.js split (R3c) but the harness never measured (it did server latency + boot + heap only, and the R0 numbers were against an empty library). docs/perf-baseline.md now records the pre-lift baseline on the Arcturus feedpak: p50 ~2.2 ms, p95 spread 2.7-3.2 ms across 3 runs. The H-container lift (next) re-runs this on the same box and must stay within noise. Maintainer/CI-only tooling; the existing no-`--song` run is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe performance harness now supports optional song-based 2D highway draw-cost measurement with repeated-run percentile reporting. Baseline documentation and the changelog describe the capture procedure, results, and new mode. Changes2D highway draw-cost measurement
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PerfBaseline as perf-baseline.mjs
participant PlaywrightBrowser as Playwright browser
participant Highway as 2D highway
PerfBaseline->>PlaywrightBrowser: Launch song measurement with --song
PlaywrightBrowser->>PlaywrightBrowser: Wrap requestAnimationFrame
PlaywrightBrowser->>Highway: Play song and register highway.addDrawHook
Highway-->>PlaywrightBrowser: Mark frames that drew
PlaywrightBrowser-->>PerfBaseline: Return drew-frame timings
PerfBaseline->>PerfBaseline: Aggregate percentile metrics across runs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/perf-baseline.md`:
- Around line 49-52: Update the fenced code block near the performance baseline
command to specify the Bash language by changing the opening fence to ```bash,
while preserving the command contents.
- Around line 40-64: Add an [Unreleased] section to CHANGELOG.md documenting the
new performance baseline in docs/perf-baseline.md and the added --song mode in
scripts/perf-baseline.mjs, briefly noting their purpose and measured results.
In `@scripts/perf-baseline.mjs`:
- Around line 86-119: Ensure frameTimeOnce always closes the browser page by
wrapping its setup, measurement, and return logic in a try/finally block, moving
page.close() into finally. Preserve the existing error propagation and
successful result from frameTimeOnce.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 788d9145-eb65-47b0-9292-afd071cfb911
📒 Files selected for processing (2)
docs/perf-baseline.mdscripts/perf-baseline.mjs
…bit) - frameTimeOnce now closes its page in a finally, so a failing run doesn't leak the page until the final browser.close() (CodeRabbit). - fenced code block gets a bash language hint (MD040). - CHANGELOG mentions the new --song frame-time mode.
The frame-time gate for the
highway.jssplit (R3c). The harness measured server latency + boot + heap but never frame time, and the R0 numbers were against an empty library — so there was nothing to gate the renderer split against. This adds it.What
scripts/perf-baseline.mjs --song "<filename in DLC_DIR>"measures the 2D highway's per-frame draw cost:requestAnimationFramebefore any page script runs,highway.addDrawHook),--framess across--runsruns.Tagging is load-bearing: roughly half the rAF callbacks belong to other cheap ~0.1 ms loops, and averaging them in would mask a renderer regression behind no-op frames.
Baseline captured (the gate)
On the Arcturus feedpak (
docs/perf-baseline.md):p50 ≈ 2.2 ms · p95 spread 2.7–3.2 ms. The upcoming
H-container lift turns each closure-slot read into anH.<slot>property load; this is the number that proves it doesn't cost the hot loop.Maintainer/CI-only tooling; the existing no-
--songrun is unchanged.npm run lintclean.🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Tests
--songmode that reports per-frame draw-cost percentiles (p50/p95/p99), maximum timing, and p95 spread.