Repository navigation
perf(render): skip unchanged rows in the daemon render hot path - #25
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan section 2, items 2.1 and 2.2, plus a dirty-row bug found while measuring them.
Changes
render_dirtycomputedAgentStatuson every frame of an AI pane, but its only caller (ui.rs) discarded it; the 500 msrefresh_agent_statusestick was already the sole consumer.render_dirtynow returns(), so detection timing is unchanged.vt.clear_dirtywalks rows with a peekable cursor and assumes ascending order, butrender_dirtypassedHashSetorder, so most rows were never cleared and every later frame redrew them. That largely cancelled d9ed455 ("skip unchanged rows"). The fix sorts the rows and adds adebug_assert!on the contract.Benchmarks
Release build,
--test-threads=1, µs per render, 120x40 viewport with one echoed key per frame. The benchmark now starts from a full screen of text, and an AI-pane variant was added.benchmark_echo_render_cost(client only) is unchanged.Tests
render_clears_every_redrawn_rowcodex_placeholder_on_partial_frame_fills_clean_composer_rowscodex_placeholder_is_remembered_until_it_disappearsagent_status_does_not_depend_on_rendercargo build,testandclippy --workspace.Risk
Because of the dirty-flag fix, unchanged rows are now really skipped. Any place where Ghostty fails to mark a changed row dirty would now leave stale content, where the full redraws used to hide it.