Commit a896b47c authored by Michael Comella's avatar Michael Comella Committed by Jeff Boek
Browse files

For #7820: warm BrowsersCache on background thread.

In an early iteration of his patch on a beta build, I saw no improvement over
6 runs (Pixel 2):
- Before: 401.5ms
- After: 402.17ms

This may be attributed to noise in startup performance. However,
BrowsersCache disappears from profiles completely and results in
theoretical performance gains.

When using the StartupTimeline class (not landed yet), I see a 27.75ms
runtime improvement on beta builds after this patch.
parent a42ad760
......@@ -37,6 +37,7 @@ import org.mozilla.fenix.components.Components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.session.NotificationSessionObserver
import org.mozilla.fenix.session.VisibilityLifecycleCallback
import org.mozilla.fenix.utils.BrowsersCache
......@@ -104,6 +105,7 @@ open class FenixApplication : LocaleAwareApplication() {
// Enable the service-experiments component
if (settings().isExperimentationEnabled && {
......@@ -260,6 +262,14 @@ open class FenixApplication : LocaleAwareApplication() {
private fun warmBrowsersCache() {
// We avoid blocking the main thread for BrowsersCache on startup by loading it on
// background thread.
GlobalScope.launch(Dispatchers.Default) {
private fun enableStrictMode() {
if ( {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment