Repository navigation
perf(renderer): avoid per-second spinner animation events - #19407
Conversation
There was a problem hiding this comment.
ℹ️ One minor suggestion inline — this is a clean, well-validated change.
Reviewed changes
- CSS-only core change — the working-spinner rotation moves from a per-second to a once-per-day iteration (
86400s/steps(1036800, end)/rotate(86400turn)), keeping the identical 12 steps/second compositor-driven cadence while eliminating per-secondanimationiterationdispatch through React's synthetic event system. - Benchmark + equivalence suite — a new opt-in
bench:spinnersharness (isolated Electron harness plus full-app Playwright scenarios over 1/200 real Git workspaces with subagents and a real PTY typing probe), plus pixel/phase/reduced-motion/reveal checks including the daily-wrap boundary. - Probe extraction —
measurePacedTypingfactored out of the multi-workspace typing spec intotests/e2e/paced-terminal-typing.tsand parameterized bykeyCount/keyCadenceMs.
The production change is confined to main.css. The steps() count is a timing-function parameter (no million-entry keyframe list, no JS clock), reduced-motion is unaffected, and the pixel-equivalence evidence — all 12 phases, the daily wrap, 1-channel antialias tolerance at 1× and 2× — is convincing that the larger rotate(86400turn) angle introduces no visual drift.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change updates working-spinner CSS animation timing to run for one day while preserving 12 steps per second. It adds documentation and component test coverage for the new timing and animation behavior. It introduces shared paced terminal typing measurements. It adds standalone spinner rendering and full-application benchmarks that seed workspaces and subagents, measure CPU and typing latency, verify pixels and reduced-motion behavior, trace iteration events, and write reports. Merge Risk: 🔵 Low · up to The spinner timing change is validated, but a failed terminal-typing benchmark can retain test resources until teardown. This is a bounded test-harness cleanup risk and does not indicate a production spinner behavior failure. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The directly linked issue [ Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 14 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 519b979b-bfe3-4610-b1d0-599b67cbbec3
📒 Files selected for processing (20)
config/scripts/idle-cpu-renderer-scale-fixture.mjsdocs/reference/renderer-agent-status-performance.mddocs/reference/spinner-rendering-performance.mdpackage.jsonsrc/renderer/src/assets/main.csssrc/renderer/src/components/AgentWorkingSpinner.test.tsxtests/e2e/paced-terminal-typing.tstests/e2e/spinner-workspace-fixture.tstests/e2e/spinner-workspace-perf.spec.tstests/e2e/terminal-multi-workspace-typing-latency.spec.tstests/tools/benchmarks/spinner-rendering/app-variants.mjstests/tools/benchmarks/spinner-rendering/fixture.csstests/tools/benchmarks/spinner-rendering/fixture.tsxtests/tools/benchmarks/spinner-rendering/index.htmltests/tools/benchmarks/spinner-rendering/main.tstests/tools/benchmarks/spinner-rendering/run.mjstests/tools/benchmarks/spinner-rendering/sample-cpu.mjstests/tools/benchmarks/spinner-rendering/trace-iterations.mjstests/tools/benchmarks/spinner-rendering/verify-pixels.mjstests/tools/benchmarks/spinner-rendering/verify-rendering.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| const maxTimerDriftMs = await timerDrift.evaluate((watcher) => watcher.stop()) | ||
| await timerDrift.dispose() |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Stop timerDrift on every exit path.
If page.keyboard.type, the echo watcher, or a wait fails, control exits after Line 175 and skips this cleanup. The renderer interval and remote handle then remain active until page teardown. Put the stop() and dispose() calls in a finally that surrounds the measurement flow.
The script launches Electron via Playwright but skipped ensure:electron-runtime, which every other Electron-launching bench script runs first.
|
Reviewed. Approving — the production change is a two-line CSS swap, the supporting benchmark code is opt-in and well isolated, and the write-up is unusually honest (it reports the ablation that contradicted its own CPU headline rather than dropping it). Verified locally on this branch:
One gap in the visual validation, non-blocking.
It is not a defect. Computed Worth knowing because "Pixel tolerance is one channel level" in Also pushed one fix from @pullfrog's review: Left unaddressed: CodeRabbit's |
|
Addressed the one actionable item in the approval note: the Pushed
|
There was a problem hiding this comment.
✅ No new issues found — the prior feedback is addressed cleanly.
Reviewed changes
bench:spinnersruntime gate — thebench:spinnersscript now runspnpm run ensure:electron-runtime && node tests/tools/benchmarks/spinner-rendering/run.mjs, matchingbench:idle-cpu/bench:startup/bench:daemon-coldstartso the Electron binary exists beforeelectron.launch(). This resolves the sole thread from the prior review.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
A spinner already turns without JavaScript driving every frame. But it still tells React "I finished a lap" every second, and those notifications interrupt the thread that handles typing.
This makes one animation contain a day's worth of laps. It looks and moves the same, but sends that notification once a day. Visible drawing still costs something; this removes avoidable bookkeeping.
What Changed
Why
This preserves the two later historical fixes:
animationstart, avoiding a synchronous style query at every mount.The new change removes almost all CSS iteration boundaries. React delegates animation-iteration listeners even without a component handler. It adds no DOM nodes, JS clocks, observers, or per-frame style writes, and keeps the existing phase synchronization. Historical benchmark totals are not directly comparable with this run.
Benchmarks
one-agentone-family200-flat200-lineage"CPU ms/sec" is processor time spent during one second: 100 ms/sec is about 10% of one CPU core. Renderer + GPU-process CPU includes their other Orca work; it is not GPU hardware usage or total system CPU. Main-thread time is included in renderer time. Echo p90 means 90% of sampled keys were observed within that time.
Main-thread median time fell about 35–50% across all four cases, and separate 2.2-second native traces counted 6 / 16 / 324 / 2,802 iteration events before versus zero after. This verifies avoided work in the real app without installing a benchmark iteration listener.
Total CPU was roughly unchanged for one worktree, and fell 13% / 9% in the final 200-worktree runs. A shorter ablation had mixed total-CPU results (flat list: 89 → 108 CPU ms/sec) while still reducing main-thread time. The reliable claim is reduced event and main-thread work; the CPU percentages are local measurements, not guarantees. Typing stayed similar in small/flat cases and improved in the final lineage run; a shorter run showed similar lineage typing, so no general typing speedup is claimed.
The 200-workspace cases seed 400 working root agents and 800 subagents. Normal virtualization mounts 23 workspaces / 162 rings; expanded lineage mounts all 200 / 1,401 rings. Both have 15 visible rings. The one-workspace cases have 1 agent / 3 rings and 2 root agents + 4 subagents / 8 rings.
Four interleaved 10-second CPU samples per variant; two 64-key typing runs at 113 ms cadence, with up to 40 status updates/sec. CPU, typing, and native traces are measured separately. No samples are discarded. The detailed report includes every CPU sample and reproduction commands: full report.
These are macOS / Apple M4 measurements in hidden, unthrottled Electron 43.4.1 renderers. Worktrees and the typing PTY are real; working agent statuses are deterministic fixture data, not hundreds of live model sessions or streaming PTYs. Linux, Windows, SSH transport, native display latency, and battery use were not benchmarked.
A containment prototype saved more CPU but shifted a small ring by one pixel at minimum zoom on a 1× display; a pseudo-element prototype also hurt typing latency. Both are excluded. Their results are not the numbers for this patch. The optional benchmark variant retains containment for reproducible comparison.
Linked Issue
Related historical issue: STA-3328, addressed by #12359. This is follow-up performance work requested by the maintainer.
Visual Proof
N/A — no intended visual or interaction change. Automated CDP comparisons passed for 6/8 px rings at 1× and 2× display density, light/dark themes, supported zoom extremes, every phase, long elapsed times, and the daily wrap: 1,440 ring comparisons, allowing one antialias channel level of rounding.
Testing
pnpm tc:web).The wider E2E TypeScript project has existing errors in unrelated specs; none were reported in the changed spinner benchmark or extracted typing files. Full-repository lint and tests were not run. All launched apps remained hidden and unfocused with
ORCA_BACKGROUND_LAUNCH=1; no native-focus tests were run on the desktop.Review