perf: batch TUI refreshes and render only visible cards - #305
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.
Every incoming trace or runtime status previously triggered a redraw, and each redraw formatted the entire retained history, including when a single card was expanded. Batch incoming messages and cap redraws at 60 FPS, while flushing the final pending frame after a burst and avoiding redraws while idle.
Build cards around the visible viewport, with bounded lookahead for variable heights, and format only the selected card in expanded view. Preserve scrolling and truncation, and keep the latest or selected card visible when the panel is shorter than a full card. Add seven renderer regression tests covering bounded formatting work, resizing, scrolling, expanded views, truncation, and minimal viewports.
Local renderer benchmark: debug build, 100×40 Ratatui TestBackend, 2,000 synthetic trace events, 50 warmup draws and 500 measured draws. Median redraw times:
The updated auto-refresh list takes about 1.89 ms with either 20 or 2,000 retained events.
Validation completed on the same source tree as this PR:
cargo fmt --allcargo clippy --all-targets --all-features -- -D warningscargo test -p ghostscope-ui --all-features: 157 passedContainer-topology e2e was intentionally skipped because this change does not affect container behavior.