perf: render only when the view changes - #1776
Open
anandh8x wants to merge 2 commits into
Open
Conversation
anandh8x
marked this pull request as ready for review
August 20, 2026 08:21
Author
|
Fixed one missed wake-up case: queued terminal sequences now wake the renderer, so they flush even when no view render follows. Added a regression test for it. |
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.
What changed
WithFPSas the maximum active render rate.Why
The current renderer starts a fixed-rate ticker for the full lifetime of every program. Even when the model schedules no commands and its view never changes, the process wakes and compares the frame at the configured FPS.
This keeps the same initial-frame ordering and active frame-rate ceiling, but lets the renderer block after the screen becomes unchanged. The next view change wakes it immediately; updates arriving inside one frame interval are rendered together.
Reproduction and result
Measured with a static Bubble Tea v2.0.9 model whose
Viewnever changes and whoseInitandUpdateschedule no commands. Both binaries ran in the same 80x24 real PTY, settled for 3 seconds, and were sampled for 10 seconds.In an animation-enabled interactive run, both versions emitted 139 active output events. Mean active gaps were 15.75 ms before and 15.68 ms after, so the change did not reduce active rendering cadence.
Validation
go test ./... -count=1go vet ./...go test -race ./... -count=1