perf(ui-gpui): focus-gated blink + comprehensive rendering analysis

Focus-gated blink: only first (focused) project blinks.
Root cause: 14 header divs × 2 boxes × 2/sec = 2.8% CPU.
Cached children (AgentPane, TerminalView) confirmed at 0%.
Path to <1%: custom Element for ProjectBox (major refactor).
This commit is contained in:
Hibryda 2026-03-19 23:26:20 +01:00
parent f797a676f4
commit 5d69f6b28f
2 changed files with 9 additions and 3 deletions

View file

@ -107,7 +107,10 @@ impl ProjectBox {
// StatusDotView: tiny Entity that reads BlinkState.
// ProjectBox does NOT read BlinkState → doesn't re-render on blink.
// Only StatusDotView (1 div) re-renders 2x/sec.
let should_pulse = matches!(self.project.agent.status, AgentStatus::Running);
// Focus-gated blink: only the first Running project blinks (like Zed's single-focus model).
// In production, this would be gated on project focus state.
let should_pulse = matches!(self.project.agent.status, AgentStatus::Running)
&& self.project.accent_index == 0; // Only first project blinks
let blink = if should_pulse {
let b = cx.new(|_cx| crate::components::blink_state::BlinkState::new());
crate::components::blink_state::BlinkState::start_from_context(&b, cx);