Skip to content

Keep the glass background a fixed size while the panel animates - #95

Merged
jordan-cod merged 2 commits into
mainfrom
perf/glass-memory
Oct 25, 2026
Merged

jordan-cod merged 2 commits into
mainfrom
perf/glass-memory

Conversation

@jordan-cod

Copy link
Copy Markdown
Owner

Why

Pullo's memory peaked at ~300 MB for a second or two each time the panel opened, then fell back to ~50 MB. footprint sampled 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.25 recorded it:

Variant Peak
Solid style 26 MB
Glass style (today) 306 MB
Glass, no reveal blur 283 MB
Glass, no shadow 274 MB
Glass, no glass on buttons and tabs 293 MB
Glass, no glass background 27 MB
Glass background in the notch shape, fixed size per state 114 MB
Glass background as a rectangle, fixed size per state (this PR) 28 MB

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

  • NotchBackground takes an optional glassSize. When set, the glass is a Rectangle of that size, pinned to the top, with animations disabled. The existing animated clipShape(shape) gives it the notch outline.
  • NotchRootView passes 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).
  • The Settings style preview keeps the old path.

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.

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.
@jordan-cod
jordan-cod merged commit 14d8aad into main Oct 25, 2026
3 checks passed
@jordan-cod
jordan-cod deleted the perf/glass-memory branch October 25, 2026 18:40
@jordan-cod jordan-cod mentioned this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant