Cache PlatformServiceBridge#canUseGms |
|||
Issue descriptionThe downstream implementation of PlatformServiceBridge#canUseGms is pretty expensive (2.5 ms according to recent benchmarks [1]), so it would be great if we could cache this to avoid recomputing the same value. Fortunately, we compute this during the constructor. We can create canUseGmsInternal to compute the value, and turn canUseGms() into an accessor. AwSafeBrowsingApiHandler relies on calling canUseGms() during its init() method, so this may actually improve startup performance (I'll investigate if there is any positive impact). I'll post any performance measurements to https://docs.google.com/spreadsheets/d/1TznEiJKznfQ3jzSGx6H_1MSdSEvExswRtyRzOp2hn-U/edit?usp=sharing [1] https://android-webview.teams.x20web.corp.google.com/startup/load_chrome_blank_2018-04-20_02-27-26_78511.html
,
Apr 28 2018
Hmm it's hard to measure startup improvement, because our startup script loads about:blank, and we don't perform Safe Browsing checks for that URL (so we only call canUseGms() once). I'll remove the blocking issue, since this doesn't contribute to WebViewStartupInterval.
,
May 7 2018
Please add the manual verification steps to verify the fix.
,
May 7 2018
No manual verification necessary--this is not expected to change behavior, it just provides a slight perf win. If this change had a bug, it would mean that Safe Browsing would be completely broken. I verified locally that Safe Browsing continues to function. |
|||
►
Sign in to add a comment |
|||
Comment 1 by bugdroid1@chromium.org
, Apr 28 2018