chore: audit components

This commit is contained in:
2026-11-10 15:06:16 +07:00
parent af2177c6c8
commit 03369f501e
92 changed files with 2744 additions and 1947 deletions
+16 -5
View File
@@ -1,6 +1,5 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::time::Instant;
use gpui::{
AppContext as _, Context, Entity, IntoElement, ParentElement as _, Render, SharedString,
@@ -78,19 +77,31 @@ fn typing_with_the_palette_open_is_not_pathologically_slow() {
window.draw(cx).clear(cx);
});
let started = Instant::now();
// The open palette must sit idle on executor timers, never frame requests.
let frames = visual.update(|window, cx| window.simulate_next_frame(cx));
assert_eq!(
frames, 0,
"an idle open palette must not request animation frames"
);
for letter in "abcdefghijklmnopqrstuvwxyz".chars() {
visual.simulate_keystrokes(&letter.to_string());
visual.update(|window, cx| {
window.draw(cx).clear(cx);
});
}
let elapsed = started.elapsed();
let total_renders = *renders.borrow();
println!(
"26 real keystrokes with the palette open: {elapsed:?}, host renders: {total_renders} ({} per keystroke)",
"26 real keystrokes with the palette open: {total_renders} host renders ({:.2} per keystroke)",
total_renders as f32 / 26.
);
assert!(elapsed.as_millis() < 2000, "typing took {elapsed:?}");
assert!(
total_renders >= 26,
"every keystroke must redraw the page; got {total_renders} renders"
);
assert!(
total_renders <= 26 * 3,
"typing caused {total_renders} host renders; healthy filtering stays under 3 per keystroke"
);
}