Redraw the macOS window only when something changed, and cache scaled pictures - #898
Merged
Merged
Conversation
… pictures - present marks the view for display only when the frame differs from the last one (Frame is now Equatable) or a picture it names was rewritten, appeared or went (Renderer.picturesChanged). The managed loop presents at 60 fps, and the whole window was redrawn on every one of them. Resizes, splitter drags and backing scale changes are invalidated as they happen. - A picture scaled down is kept at the device pixels it fills (Renderer.fitted), so a redraw copies it rather than resampling the source. A picture drawn at or above its own size is drawn as before, which leaves the capture baselines as they are.
# Conflicts: # todo.md
This was referenced Sep 23, 2026
Merged
Merged
Merged
Merged
Merged
This was referenced Sep 24, 2026
Merged
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.
Fixes the macOS repaint item from
todo.md. The binaries were rebuilt bybuild-native(#897, fast-forwarded into this branch).Runtime.presentmarks the view for display only when the frame differs from the last one (Frameis nowEquatable) or when a picture it names was rewritten, appeared or went (Renderer.picturesChanged, a stat per shown picture). The managed loop presents at 60 fps, and every present redrew the whole window, so an idle viewer kept a core busy. Resizes and splitter drags were already invalidated by AppKit and the view. A move to a display of another scale now invalidates too (viewDidChangeBackingProperties), because it changes the device pixels a scaled picture fills.Renderer.fitted), and a redraw copies it rather than resampling the source. The cache is dropped with the picture, so the existing eviction still bounds it. A picture drawn at or above its own size is drawn as before, which is every picture the capture baselines contain, so they're unaffected.Not measured: there's no Mac here, so CI compiling the Swift and running the macOS pixel tests is the verification. Watching Activity Monitor on an idle viewer before and after would show the effect.
Only
native/swiftandtodo.mdchange. The Windows image perf item, which #896 fixes, is still listed in this branch'stodo.mdand will merge cleanly beside it.