UpdateEmptyToolbarMessage is doing expensive work during bookmark operations
Categories
(Firefox :: Toolbars and Customization, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox115 | --- | fixed |
People
(Reporter: mak, Assigned: mak)
References
(Blocks 1 open bug)
Details
(Keywords: perf, perf:responsiveness)
Attachments
(1 file)
I took a profile from the suggestion in bug 1533061
https://share.firefox.dev/3XWswU0
on notifications we're spending 19% of the time in updateEmptyToolbarMessage
https://searchfox.org/mozilla-central/rev/75da1dd5d4b9b991f919a41594194eab93cdef62/browser/base/content/browser-places.js#1630,2212
in particular we seem to execute it regardless of the notification, this final catch-all call is bad, it should only activate when changes are made to bookmarks on the toolbar. For example "bookmark-moved" is doing that (that's worse cause in that case we do it twice).
It also sounds like something we could cache, and then just update using the notifications.
This expensive path is actually taken every time we can't find DOM children on the toolbar, but the querySelector is wrong
https://searchfox.org/mozilla-central/rev/75da1dd5d4b9b991f919a41594194eab93cdef62/browser/base/content/browser-places.js#1612-1616
:scope > toolbarbutton:not([hidden]), doesn't match bookmarks on the toolbar here.
Finally, PlacesUtils.getChildCountForFolder is doing synchronous IO, but that is likely something we knew already, we just failed avoiding excessive calls. Of course if necessary we can expose an async API from Bookmarks, but the code must be refactored to async.
| Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 1•3 years ago
|
||
The Performance Impact Calculator has determined this bug's performance impact to be medium. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.
Platforms: [x] Windows [x] macOS [x] Linux
Impact on browser: Causes noticeable jank
Comment 2•3 years ago
•
|
||
(In reply to Marco Bonardo [:mak] from comment #0)
This expensive path is actually taken every time we can't find DOM children on the toolbar, but the querySelector is wrong
https://searchfox.org/mozilla-central/rev/75da1dd5d4b9b991f919a41594194eab93cdef62/browser/base/content/browser-places.js#1612-1616
:scope > toolbarbutton:not([hidden]),doesn't match bookmarks on the toolbar here.
FWIW, I think it's not supposed to - it's supposed to match other buttons that get customized onto the toolbar. We also explicitly exclude #personal-bookmarks from the toolbaritem selector, so I'm fairly sure this was intentional at the time.
(Of course, it seems likely there is some better way of doing what the code is trying to do, but that also feels like a separate question...)
| Assignee | ||
Comment 3•3 years ago
|
||
(In reply to :Gijs (he/him) from comment #2)
FWIW, I think it's not supposed to - it's supposed to match other buttons that get customized onto the toolbar. We also explicitly exclude
#personal-bookmarksfrom the toolbaritem selector, so I'm fairly sure this was intentional at the time.
Ah I see.
That's still a bit surprising, it would be much cheaper to check if bookmark nodes exist on the toolbar through the DOM, than by querying Places.
| Assignee | ||
Comment 5•3 years ago
|
||
Updated•3 years ago
|
Comment 7•3 years ago
|
||
| bugherder | ||
Description
•