perf(ui-gpui): custom Element header, 2.73% CPU (down from 90%)
ProjectBoxHeaderElement: 5 paint_quad + 2 text runs, zero Taffy nodes. Flattened hierarchy + SharedBlink + cached children + focus-gated blink. GPUI architectural floor: cx.notify() always walks ancestors.
This commit is contained in:
parent
54e68df295
commit
f0c55403b8
3 changed files with 141 additions and 21 deletions
|
|
@ -9,6 +9,7 @@
|
|||
use gpui::*;
|
||||
use crate::CachedView;
|
||||
|
||||
use crate::components::project_box_element::ProjectBoxHeaderElement;
|
||||
use crate::state::{AgentStatus, Project, ProjectTab};
|
||||
use crate::theme;
|
||||
// blink_state used via fully-qualified path in init_subviews + render
|
||||
|
|
@ -227,27 +228,15 @@ impl Render for ProjectBox {
|
|||
.border_1()
|
||||
.border_color(theme::SURFACE0)
|
||||
.overflow_hidden()
|
||||
// ── Header (minimal divs: 1 row + accent stripe + dot entity) ──
|
||||
.child(
|
||||
div()
|
||||
.w_full()
|
||||
.h(px(36.0))
|
||||
.flex()
|
||||
.items_center()
|
||||
.px(px(12.0))
|
||||
.gap(px(8.0))
|
||||
.bg(theme::MANTLE)
|
||||
.border_b_1()
|
||||
.border_color(theme::SURFACE0)
|
||||
.child(div().w(px(3.0)).h(px(20.0)).rounded(px(2.0)).bg(accent))
|
||||
.child(crate::components::blink_state::render_status_dot(
|
||||
self.project.agent.status,
|
||||
self.shared_blink.as_ref(),
|
||||
))
|
||||
.child(self.cached_name.clone())
|
||||
.child(div().flex_1())
|
||||
.child(self.cached_cwd.clone()),
|
||||
)
|
||||
// ── Header — custom Element: 5 paint_quad + 2 text runs, zero Taffy nodes ──
|
||||
.child(ProjectBoxHeaderElement {
|
||||
id: self.id_project.clone().into(),
|
||||
name: self.cached_name.clone(),
|
||||
cwd: self.cached_cwd.clone(),
|
||||
accent,
|
||||
status: self.project.agent.status,
|
||||
blink_visible: self.shared_blink.as_ref().map(|b| b.visible.clone()),
|
||||
})
|
||||
// ── Tab Bar (1 div + 3 inline tab labels) ──
|
||||
.child(
|
||||
div()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue