perf(ui-gpui): cache SharedStrings, remove diagnostics, zero alloc per render frame

- BlinkState as shared Entity (not child) → cx.notify() only dirties ProjectBox,
  NOT ancestors (Workspace, ProjectGrid). Siblings serve from GPU cache.
- .cached(StyleRefinement::default()) on all Entity children in Workspace,
  ProjectGrid, ProjectBox → GPUI replays previous frame's GPU commands via memcpy
- CachedView trait: Entity<V>.into_cached_view() → AnyView::from().cached()
- Result: 4.5% CPU → 0.83% CPU (25 ticks / 30s) for pulsing dot animation
This commit is contained in:
Hibryda 2026-03-19 22:35:41 +01:00
parent ad45a8d88d
commit 73cfdf6752
6 changed files with 104 additions and 29 deletions

View file

@ -4,6 +4,7 @@
//! enough for multiple columns.
use gpui::*;
use crate::CachedView;
use crate::components::project_box::ProjectBox;
use crate::state::AppState;
@ -59,7 +60,9 @@ impl Render for ProjectGrid {
.overflow_y_scroll();
for pb in &self.project_boxes {
grid = grid.child(pb.clone());
// Cached: ProjectBox only re-renders when its entity is notified
// (e.g., PulsingDot blink). Sibling ProjectBoxes serve from GPU cache.
grid = grid.child(pb.clone().into_cached_view());
}
if self.project_boxes.is_empty() {