Open Bug 1350749 Opened 8 years ago Updated 2 years ago

Add some instrumentation to find commonly added preference observers

Categories

(Core :: General, enhancement)

enhancement

Tracking

()

Performance Impact low

People

(Reporter: ehsan.akhgari, Unassigned)

References

Details

(Keywords: perf)

Preference observers can be expensive to set, see for example bug 1350745. In places where we have one preference observer per object, we should try to see if it's feasible to have one global preference observer that notifies all existing objects, or use better APIs (like the "var cache" APIs in C++.) So we should add some instrumentation to find the observers that are commonly set.
Whiteboard: [qf]
Whiteboard: [qf] → [qf:p3]
Felipe, are you interested in taking this one as well?
Flags: needinfo?(felipc)
Hmm I'm not sure I enterily understand this bug. I believe it was a follow-up to bug 1350745, but I don't get why _setting_ those observers were expensive (as opposed at calling them when the notification fires). - Was it because it is set and called immediately? (with RegisterCallbackAndCall) - or because browser.formfill.* matches too many prefs and the lookups became expensive - or just because there were many frame scripts (one per tab) registering this at the same time, so it showed up a lot while profiling. In any case, I probably won't take this bug for now as I'm working on some other qf bugs and I don't want this one to appear taken and block someone else interested.
Flags: needinfo?(felipc)
The cost is from the two hashtable lookups here: <http://searchfox.org/mozilla-central/rev/baf47b352e873d4516d7656186d6d7c7447d3873/modules/libpref/nsPrefBranch.cpp#726> (from the Get and Put calls respectively).
(In reply to :Ehsan Akhgari (super long backlog, slow to respond) from comment #3) > The cost is from the two hashtable lookups here: > <http://searchfox.org/mozilla-central/rev/ > baf47b352e873d4516d7656186d6d7c7447d3873/modules/libpref/nsPrefBranch. > cpp#726> (from the Get and Put calls respectively). (BTW I filed bug 1359848 to reduce this to just one hashtable lookup to reduce this cost, FWIW.)
Keywords: perf
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.