mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
perf(tui2): reduce unnecessary redraws (#8681)
This reduces unnecessary frame scheduling in codex-tui2. Changes: - Gate redraw scheduling for streaming deltas when nothing visible changes. - Avoid a redraw feedback loop from footer transcript UI state updates. Why: - Streaming deltas can arrive at very high frequency; redrawing on every delta can drive a near-constant render loop. - BottomPane was requesting another frame after every Draw even when the derived transcript UI state was unchanged. Testing: - cargo test -p codex-tui2 Manual sampling: - sample "$(pgrep -n codex-tui2)" 3 -file /tmp/tui2.idle.after.sample.txt - sample "$(pgrep -n codex-tui2)" 3 -file /tmp/tui2.streaming.after.sample.txt
This commit is contained in:
1 parent
ab753387cc
commit
3cfa4bc8be
3 files changed
+20
-4
No files matched your search
@@ -1577,11 +1577,20 @@ impl ChatComposer {
|
||||
selection_active: bool,
|
||||
scroll_position: Option<(usize, usize)>,
|
||||
copy_selection_key: KeyBinding,
|
||||
) {
|
||||
) -> bool {
|
||||
if self.transcript_scrolled == scrolled
|
||||
&& self.transcript_selection_active == selection_active
|
||||
&& self.transcript_scroll_position == scroll_position
|
||||
&& self.transcript_copy_selection_key == copy_selection_key
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
self.transcript_scrolled = scrolled;
|
||||
self.transcript_selection_active = selection_active;
|
||||
self.transcript_scroll_position = scroll_position;
|
||||
self.transcript_copy_selection_key = copy_selection_key;
|
||||
true
|
||||
}
|
||||
|
||||
fn sync_popups(&mut self) {
|
||||
|
||||
@@ -389,13 +389,15 @@ impl BottomPane {
|
||||
scroll_position: Option<(usize, usize)>,
|
||||
copy_selection_key: crate::key_hint::KeyBinding,
|
||||
) {
|
||||
self.composer.set_transcript_ui_state(
|
||||
let updated = self.composer.set_transcript_ui_state(
|
||||
scrolled,
|
||||
selection_active,
|
||||
scroll_position,
|
||||
copy_selection_key,
|
||||
);
|
||||
self.request_redraw();
|
||||
if updated {
|
||||
self.request_redraw();
|
||||
}
|
||||
}
|
||||
|
||||
/// Show a generic list selection view with the provided items.
|
||||
|
||||
Reference in new issue
Block a user