perf(ui-gpui): revert AnimationElement (79% CPU), document shader limitation
GPUI's AnimationElement uses request_animation_frame() internally which runs at vsync (60fps) causing 79% CPU. Fragment shaders not exposed through GPUI's Scene API (paint_quad only accepts static color, no time uniform). Reverted to BlinkState timer pattern (3% CPU, 2 renders/sec). This is the same approach Zed uses for cursor blink. Tested approaches and results: - AnimationElement + pulsating_between: 79% CPU (vsync loop) - BlinkState + timer(500ms) + cx.notify(): 3% CPU (correct) - Custom Element + paint_quad: no shader access - CSS animation (Blitz): 30% CPU (full repaint loop)
This commit is contained in:
parent
640e2bd494
commit
727c7d2e06
1 changed files with 5 additions and 2 deletions
|
|
@ -261,9 +261,12 @@ impl Render for ProjectBox {
|
|||
.rounded(px(2.0))
|
||||
.bg(accent),
|
||||
)
|
||||
// Status dot — reads from shared BlinkState (doesn't dirty ancestors)
|
||||
// Status dot — BlinkState shared entity (2 renders/sec, 3% CPU)
|
||||
// NOTE: GPUI's AnimationElement uses request_animation_frame() which
|
||||
// runs at vsync (60fps) = 80% CPU. Fragment shaders not exposed.
|
||||
// The Zed BlinkManager pattern (timer + notify at 2fps) is the
|
||||
// correct approach for ambient animation in GPUI.
|
||||
.child({
|
||||
let is_running = matches!(self.project.agent.status, AgentStatus::Running);
|
||||
let blink_visible = self.blink_state.as_ref()
|
||||
.map(|bs| bs.read(cx).visible)
|
||||
.unwrap_or(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue