-
Notifications
You must be signed in to change notification settings - Fork 473
Having a larger number of tabs slows down cold startup #7304
Comments
After looking into it more, this seems to be (partially) caused by |
Possibly relevant for the above https://bugzilla.mozilla.org/show_bug.cgi?id=1639978 |
After further testing the |
Probably late to the party, but I think a startup profile could give some useful insight on the problem :) There is a documentation on how to profile the fenix startup here: https://profiler.firefox.com/docs/#/./guide-remote-profiling?id=startup-profiling-fenix |
See mozilla-mobile/fenix#7035 for an older version of this issue. |
Triage: we may revisit as part of the holistic startup effort; but otherwise let's revisit this next week. |
One thing I've seen implied somewhere else is that we think that such a slow down is inherently necessary? I feel like we should be able to make startup time not depend on number of tabs at all (within a few orders of magnitude). Besides the first few tabs all we need to read at startup is the URL/Title, we can load screenshots / all the metadata lazily if the user scrolls the tab view, or just a little later after startup. |
@csadilek made a note that he wasn't able to see this issue any more and indeed after loading 150 tabs as well (I used your script to keep it as close to your initial testing), I'm not seeing any slow down. We've had many perf fixes go in already in various levels that we might have fixed this inadvertently! @agi are you able to reproduce the slow down any more on the latest nightly? |
I'll run some tests overnight! |
@agi What phone are these analyses taken from? |
@mcomella Samsung S7 |
I took a few measurements myself with the two test devices I had. I also have a Nexus 5 but simpleperf doesn't seem to work on Android 6.0 Start-up Profile (15-09-20,
|
Attempt | Link | Notes | Device |
---|---|---|---|
1 | https://share.firefox.dev/35GuKzK | Clean install | Pixel 4 |
2 | https://share.firefox.dev/33w23Tf | Clean install | Pixel 4 |
3 | https://share.firefox.dev/2E4NZrh | 150 tabs restored | Pixel 4 |
4 | https://share.firefox.dev/3hDnff4 | 150 tabs restored | Pixel 4 |
5 | https://share.firefox.dev/2ZIwIvo | 150 tabs restored | Pixel 4 |
6 | https://share.firefox.dev/35GB9dV | 1 tab restored | Pixel 4 |
7 | https://share.firefox.dev/32EDLar | Clean install | Pixel 2 |
8 | https://share.firefox.dev/3iTrJ2R | 1 tab restored | Pixel 2 |
9 | https://share.firefox.dev/3mG0ISK | 1 tab restored | Pixel 2 |
10 | https://share.firefox.dev/32DgOEr | 150 tabs restored | Pixel 2 |
11 | https://share.firefox.dev/3kqiMOx | 150 tabs restored | Pixel 2 |
When performing a clean install, I didn't notice anything significant happening there either.
The results are not consistent from some issues I've had with measuring startup, but there are some noticeable increases in launch time when loading 150 tabs from SessionManager.restore which is roughly 300ms more. This would make sense since we're reading in more session from disk during restore.
I'm not sure just yet what we can do about this. A naive solution would be to remove the syncDispatch
calls and make it async, but that will probably lead to really weird states. I need to investigate if this is only an issue because of the synchronized states of SessionManager to BrowserState that we have during the migration to deprecation SessionManager.
Thanks for looking into this, jonalmeida. +300ms seems like a very long time for 150 items, especially for a P2/P4: what are we restoring? Is there some part of the session we should be loading on-demand (e.g. thumbnails or similar)? Are we blocking for gecko to finish loading to give us the session? We should identify the root cause of this seemingly abnormal duration in order to determine an appropriate fix. fwiw, the ideal state for startup is that we aren't blocking the main thread for IO at all. In some cases the complexity is not worth it (e.g. Gecko initialization) but the FE perf team isn't at a point where we can identify where all the main thread-blocking IO is occurring and which ones are worth keeping due to the complexity. Try to keep this in mind as you design a solution: we're not asking for a non-blocking solution today but we might ask for it tomorrow. :) Chrome basically does nothing on startup so we need to do everything we can to compete. |
This comment has been minimized.
This comment has been minimized.
We believe #8535 may (partially? fully?) address this issue. |
…ndividual actions to restore tabs
…ndividual actions to restore tabs Co-authored-by: Jonathan Almeida <[email protected]>
…ndividual actions to restore tabs Co-authored-by: Jonathan Almeida <[email protected]>
… tabs Co-authored-by: Jonathan Almeida <[email protected]>
An update for the issue: we've landed our fixes in AC, however due to some build pipeline issues, we haven't got this into Fenix yet. |
We have a new nightly with the latest AC version in it (verified from About Fenix with the git SHA @agi you should see some changes to the cold start-up time now. 🙂 |
New graphs/numbers coming soon :) |
Curious, compared to the graph from Sept 1 #7304 (comment), the absolute values are faster too – from 4500ms on Sept 1 to ~3750ms today. 🤔 |
@mcomella I wouldn't pay too much attention to the absolute numbers, there's a lot of factors that can impact perf on this device, it's definitely non in a clean state every time. I can, however, do a test before/after back-to-back which should be way more accurate, if you're interested. |
While doing an unrelated startup performance investigation, I noticed that having a large number of tabs significantly slows down cold startup (tested on latest Fenix nightly).
This is the test I was running:
An empirical result is below, x axis is number of tabs, y axis is startup time to fragment rendered in milliseconds, purple points are raw measurements and green points are average [0, x] with error bars.
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: