fix: reduce overview open lag#130
Merged
flexagoon merged 4 commits intoflexagoon:mainfrom Mar 27, 2026
Merged
Conversation
- Cache Gio.Settings object and fractional scaling result in
windowScaleFactor() — was allocating a new GSettings object on every
call, which runs per-frame per-window inside vfunc_allocate during
overview animations
- Replace new Error().stack call stack inspection in addShadowInOverview
with window.get_transient_for() check to detect attached dialogs
- Deduplicate getPref('global-rounded-corner-settings') calls in
updateShadowActorStyle from 3-4x down to 1x per call
- Skip queue_redraw() when shadow style string hasn't changed
- Prune disconnected entries from connections[] array on window close
flexagoon
requested changes
Mar 18, 2026
Owner
flexagoon
left a comment
There was a problem hiding this comment.
A few nits, LGTM otherwise, thanks!
Comment on lines
+115
to
+116
| let i = connections.length; | ||
| while (i--) { |
Owner
There was a problem hiding this comment.
Could this use connections.entries() instead?
Author
There was a problem hiding this comment.
Using connections.entries() will make this method two pass as we will need to disconnect and then collect the indices of the disconnected objects, after that we will splice the connections array, so I think this one pass solution is better.
Owner
There was a problem hiding this comment.
@elkhaligy I see, then could you please add a code comment explaining that? (And preferably also the reason for why the array is spliced in the first place)
Author
|
Great! I will work on the comments |
added 2 commits
March 19, 2026 16:47
getMutterSettings was only ever called in one place, so inline it directly into isFractionalScalingEnabled where the lazy init and signal subscription make more contextual sense. Also move misplaced imports to the top of the file and add JSDoc to isFractionalScalingEnabled and clearMutterSettingsCache.
Without removing the entry after disconnecting, the array would hold references to dead window GObjects indefinitely, leaking memory proportional to the number of windows opened over the session.
Owner
|
@elkhaligy thank you so much! |
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.
Summary
Gio.Settingsobject and fractional scaling result inwindowScaleFactor()— was allocating a new GSettings object onevery call, which runs per-frame × per-window inside
vfunc_allocateduring overview animations (60fps × N windows)new Error().stackcall stack inspection inaddShadowInOverviewwithwindow.get_transient_for()to detectattached dialogs — stack trace capture fired for every window on
every overview open
getPref('global-rounded-corner-settings')calls inupdateShadowActorStylefrom 3-4x down to 1x per callqueue_redraw()when the shadow style string hasn't changed,avoiding unnecessary GPU repaints on focus changes
connections[]array on windowclose, preventing unbounded growth over the session
Root cause
The main bottleneck was
windowScaleFactor()callingGio.Settings.new('org.gnome.mutter')on every invocation. Thisfunction is called from
vfunc_allocateon the overview shadowclone actors, which Clutter calls on every layout pass during
overview animations, meaning every frame × every window was
allocating a new GSettings object and reading from the GSettings
daemon. The fix caches the settings object and the derived boolean
at module level, invalidating only when
experimental-featuresactually changes.
Closes #22