perf(chat): reduce speculative mounts during large transcript flings
A fast transcript fling currently mounts the capped directional band plus two predicted landing windows. This candidate omits that intervening band only when a single scroll step exceeds the four-viewport cap, while retaining one viewport on either side of the current view and both predicted windows. Moves of four viewports or less retain the existing contiguous lead.
HOLD: This PR's same-worker A/B validation, strict slowdown/reversal coverage, independent review, and webview verdict are outstanding. Do not land until those results establish that it helps without worsening blank frames.
Leo: "i feel like the app is slow on scrolling thru stuff... claude desktop is 120hz or something and ours is wack + it has sometimes not even rendered stuff!?"
The implementation and focused regression tests are complete; verification is pending. This ordinary PR enables the fleet test route. It makes no performance-improvement or native 120 Hz claim. Stacked on #33358; the harness is identical in both A/B variants.
Risk: a six-viewport step followed by a two-viewport slowdown can enter the omitted band before the next mount commit. The new browser regression checks abrupt slowdown and reversal in both directions with zero blank frames, in the middle of the transcript. Reject this candidate if coverage worsens. No App.tsx, first-paint, initial rail entrance, Swift, timers, warm-window quantization, or idle-decay changes.
Prior art: #19981 introduced the predicted windows and kept the capped band for uneven drags; this preserves both predictions and the existing 2–4 viewport drag path. #31320 warm-window quantization, #31760 idle lead decay, and #32837 indexed geometry remain intact. Design spec: leo-workspace design/chat-transcript.md; presentation is unchanged.
| Metric | Before | After | Delta | Harness or run link |
|---|---|---|---|---|
| Fast fling React p95, two rounds | 74 / 68 ms | Pending | Pending | Shared 3000-row harness |
| Fast fling blank frames / blank time | Same-worker baseline pending | Pending | Pending | Separate coverage pass in scroll-lead-ab.py |
Validation completed: changed-file formatting, light web lint with type-aware checks deferred to fleet, prepush-gate (no new violations), git diff --check, and Python syntax. Browser tests, range tests, A/B timing and coverage have not run for this head.
Fleet command, after installing webviews dependencies and WebKit:
python3 scripts/cmux-next/scroll-lead-ab.py --baseline a567667a8f6f55c580f494a38eeec9554108c88e --out /tmp/scroll-lead-ab
The runner records exact commits, host, per-command exit status, and logs; restores model.ts after each comparison; and keeps timing separate from coverage sampling. It changes only scrollLeadRanges between variants and uses the same regression tests and benchmark for both.
🤖 Generated with Codex
Agent session: agent session
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fast transcript flings currently mount the capped directional band plus two predicted landing windows. This candidate skips that intervening band only when a single scroll step exceeds the four-viewport cap, keeping one viewport on either side of the current view plus both predicted windows; moves of four viewports or less keep the existing contiguous lead. The change is held for same-worker A/B validation, slowdown/reversal coverage, and review, and makes no performance-improvement claim.
Verification
scripts/cmux-next/scroll-lead-ab.pyruns the existing benchmark and browser regressions against baseline and candidatemodel.ts, isolating onlyscrollLeadRangesand restoring the original source on exit.- New browser regression flings with an abrupt slowdown-and-reversal pattern from mid-transcript and requires zero blank frames in both directions.
- New range tests check the large-skip path mounts fewer rows while covering the current view and both predictions, and that ordinary scroll and uneven-drag steps keep the contiguous lead.