Repository navigation
native: fewer idle frames: a slow ring without focus, a rarer service beat, a cursor row left alone - #1013
Merged
Conversation
… beat, a cursor row left alone Every frame costs the window the same whatever it shows, about 0.3% of a laptop GPU, so what is left after #1011 is the frames nobody asked for: - Without focus the ring stopped dead; now it turns at 8fps, so a session is still seen working from another monitor, at a fifth of the frames. - A running service's dot beat every 2.4s, a burst of frames each time: 8 frames a second all day for a 14dp dot. It beats every 6s. - The terminal recomposed and re-uploaded the cursor's row on every frame while the cursor stayed put. The row is recomposed when the cursor moves or the row's own text changes.
TestBrowserFrameSurplusDecodesOnlyTheNewest captured the process log and wanted it empty, but a layout save of an earlier test, failing after that test's backend closed, logs there too: on the macOS runner it did. The test now looks for the decode's own line, logged under the event's name.
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.
Why
After #1011 and #1012 a busy session draws at the ring's 24fps and nothing else (measured on the real window: 41 → 23.5 frames a second, 13.6% → 7.5% of the GPU). Every frame costs the window the same whatever it shows, about 0.3% of a laptop GPU, so what is left is the frames nobody asked for.
What
ui.StillFrame(125ms) isTheme.Loop's frame whileStill: the ring turns at 8fps, a fifth of the frames.LoopFrame; the old pace was 8 frames a second for as long as a service ran, all day for a 14dp dot. Its rest now always schedules the next beat, since a still window only slows.rowRenderermarked the cursor's row dirty on every draw, recomposing it on the CPU and uploading its 1116x19 texture every frame while the cursor stayed put; now it keeps the row's image until the cursor moves (then the row it left comes with it) or the row's text changes.Tests changed for a changed contract:
TestStillThemeHoldsTheFramebecameTestStillThemeSlowsTheLoop, andTestServiceBeatPacingpins the 6s period and the slow frame while still.Test plan
TestStillThemeSlowsTheLoop,TestLoopRecordsTheFrameItAskedFor(the slow frame is recorded too)TestServiceBeatPacingTestRowsRecomposeForTheCursorOnlyWhenItMoves: nothing changed redraws no row; the cursor moving along its row redraws that row; moving to the next row redraws bothnative/: gofmt,go vet ./...,go test ./...