Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-23 Thread smaug
On 02/23/2017 11:10 AM, Masayuki Nakano wrote: Do you have any ideas of the cases we should use Add*VarCache? For example, it's bad if using Get* when: * every painting possibly * every mousemove probably * every user input except mousemove well, touchmove is happening a lot too, and

Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-23 Thread Masayuki Nakano
Do you have any ideas of the cases we should use Add*VarCache? For example, it's bad if using Get* when: * every painting * every mousemove * every user input except mousemove * every focus move * every DOM change * every page load etc. I wonder, if everybody uses Add*VarCache, doesn't it

Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-22 Thread Gijs Kruitbosch
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

Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-22 Thread Kris Maglione
On Wed, Feb 22, 2017 at 01:18:33PM +0200, smaug wrote: 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

Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-22 Thread smaug
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

Re: Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-22 Thread Gijs Kruitbosch
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

Please use Add*VarCache and not Get* when reading pref values in any even possibly warm code paths

2017-02-22 Thread smaug
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