Kit helpfully pointed out that this got fixed 6 months after I filed the referenced bug, when Matt Woodrow ran into it with a different pref - https://bugzilla.mozilla.org/show_bug.cgi?id=1267868 . So ignore my caveat - pref caches should be working normally now 'even' where the cached pref name is a string prefix of another pref name. :-)

~ Gijs

On 22/02/2017 13:23, smaug wrote:
Huh, that is a horrible bug.


On 02/22/2017 01:42 PM, Gijs Kruitbosch wrote:
Related note: add*varcache uses a pref observer behind the scenes.
Pref observers always prefix-match, and the *varcache implementation
doesn't bother
re-checking whether the pref for which it gets a notification matches
the one you requested a cache for. So if you have prefs "blah.foo" and
"blah.foo.bar", changing blah.foo.bar will write garbage into your
cache for blah.foo.

https://bugzilla.mozilla.org/show_bug.cgi?id=1208744

~ Gijs

On 22/02/2017 11:18, smaug wrote:
Hi,

Preferences::GetBool is a slow hashtable lookup and has been showing up
in performance profiles in many places.
Please use Preferences::AddBoolVarCache. Same with other pref types.
Or if the pref needs to be read just once, store the value in some
static variable or so.



-Olli



_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to