Repository navigation
Keep the glass background a fixed size while the panel animates - #95
Merged
Merged
Conversation
The glass background took the animated panel shape, so every frame of the open and close animation asked for a new backdrop surface of a new size. Opening the panel briefly took about 300 MB of graphics memory. The glass is now a rectangle sized for the state being shown, set without animation and clipped by the animated notch shape, which keeps the peak under 30 MB with no visible difference.
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.
Why
Pullo's memory peaked at ~300 MB for a second or two each time the panel opened, then fell back to ~50 MB.
footprintsampled every 0.25 s showed the peak was all graphics memory ("Owned physical footprint (graphics)" and IOSurface); Malloc stayed at 15–40 MB.How it was found
A throwaway Debug build opened and closed the panel 5 times with demo data while
footprint --sample 0.25recorded it:The background used
glassEffect(.regular, in: shape)on a view whose size and shape animate, so every frame asked for a backdrop surface of a new size.What
NotchBackgroundtakes an optionalglassSize. When set, the glass is aRectangleof that size, pinned to the top, with animations disabled. The existing animatedclipShape(shape)gives it the notch outline.NotchRootViewpasses the size of the state being shown. While closing, it keeps the last shown size so the glass never gets smaller than the shrinking clip (the closed notch is covered in black anyway).Screenshots
No visual change. Both versions were compared side by side on a real notch and looked the same, so there's no before/after to show.