notifications@cinnamon.org - Avoid redundant update_list calls during clear all#13704
Open
jsharpe1 wants to merge 1 commit intolinuxmint:masterfrom
Open
notifications@cinnamon.org - Avoid redundant update_list calls during clear all#13704jsharpe1 wants to merge 1 commit intolinuxmint:masterfrom
jsharpe1 wants to merge 1 commit intolinuxmint:masterfrom
Conversation
Contributor
|
what computer are you using? I have a 4 core ryzen3 and clearing 50 notifications takes about 150ms. There's a max of 20 notifications per app as well. |
Author
|
@fredcw This is on my laptop - CPU is 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz. Out of curiosity, I ran the same test (generating 50 notifications and clearing all) on my desktop, and did not have the same performance issue. That's running a 13th Gen Intel(R) Core(TM) i5-13600KF. |
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.
Problem
When clearing all notifications, each
notification.destroy()triggers the destroy signal handler, which callsupdate_list()individually. With N notifications, this results in N+1 calls toupdate_list(), each recalculating urgency, updating icons/labels, reordering children, and requesting a relayout. When the notification count gets high, there is a noticeable hang when it clears all notifications. 50 notifications took 6.5 seconds to clear (see screenshot below).Fix
Added a
_clearingflag that causes the destroy handler to skipupdate_list()during bulk clear. The singleupdate_list()call at the end of_clear_all()handles final state. Wrapped in try/finally to guarantee the flag resets if a destroy call throws.Testing
Tested on Cinnamon 6.6.7 by triggering 50 notifications and clearing all. Verified via Looking Glass:
** Before: **

** After: **

Also verified: