fenix icon indicating copy to clipboard operation
fenix copied to clipboard

Move setStartupMetrics() to worker thread to reduce start up time of Fenix

Open Malclir opened this issue 6 years ago • 6 comments

Why/User Benefit/User Problem

Currently, every time the application starts up , we see a heavy load from setStartupMetrics() . I.e: on a 5 seconds start up time, the method can take up to 500ms (on a Moto G5+). This can mean up to 10% of load time only on setting up Metrics.

  • Talking with the Glean team, it seems that we can initialize metrics on a separate threads. I'm not sure if there was a specific reason in Fenix for us to just initialize it on the UI thread.

Impact

Longer start up, means less appealing to users.

Acceptance Criteria (how do I know when I’m done?)

The method doesn't run on initialization ( or is done in a separate thread)

┆Issue is synchronized with this Jira Task

Malclir avatar Dec 18 '19 21:12 Malclir

I know @hawkinsw has spent some time looking at this. You might want to connect with him to share some context!

boek avatar Dec 18 '19 23:12 boek

@mcomella Based on your comment from a different issue, I know that you had some hesitations with accessing Settings off MT. We will need to address your fear before this can go forward, I think.

hawkinsw avatar Dec 23 '19 23:12 hawkinsw

Though caching the results of Browsers.all() (see PR: https://github.com/mozilla-mobile/fenix/pull/7490#) will make the performance of setStartupMetrics better, I do not think that it is a bad idea to also do it asynchronously. @mcomella and @MarcLeclair, what do you think?

hawkinsw avatar Jan 06 '20 21:01 hawkinsw

We spoke on Zoom: iirc, after hawkinsw's change, we noticed this affected the G5 pretty heavily but didn't affect the P2. We decided that, for now, we should focus on changes that only affect both reference devices. As such, I'm sending this back to triage.

mcomella avatar Jan 14 '20 23:01 mcomella

See the WIP in https://github.com/mozilla-mobile/fenix/pull/7470 & https://github.com/mozilla-mobile/fenix/pull/7517.

mcomella avatar Jan 14 '20 23:01 mcomella

Dupe https://github.com/mozilla-mobile/fenix/issues/7847

mcomella avatar Feb 24 '20 18:02 mcomella