260-524ms between HomeActivity.load and GeckoSession.load when entered hitting enter on search #21530
Comments
We implemented a fix for this a while back as part of #17645, but the conclusion from the performance team was that it didn't make any actual difference in page load times, see #17645 (comment), at least not for the case where a new tab was being opened (as in the profile above). However, we did start work on optimizations in A-C now to make sure we prevent those context-switches where we can: mozilla-mobile/android-components#11066 |
We've landed a related optimization though for the direct load case: mozilla-mobile/android-components#11067 For the above we need feedback from the performance team as the original conclusion was that it didn't make any difference. |
Triage: this is an easy fix but we don't know if it'd actually improve perf given our previous analyses. We should measure the difference before landing the change. |
Summary of the issueWhen we load a page from the search screen, there are several events that need to happen. In some cases, they are posted to the UI thread, forcing them to wait on the UI transition (which is 260-524ms, measured haphazardly) before executing. Ideally, they'd be executed synchronously before the UI transition. The events are:
Recent optimization
afaict, this didn't improve performance in most cases due to this third event – it's a platform bug where page loads with redirects are posted to the UI thread so block on the UI transition. Since most urls from the search screen redirect to https, this affects most URLs entered on the search screen. That's https://bugzilla.mozilla.org/show_bug.cgi?id=1734916 However, once that issue is resolved, I expect to see the performance benefits. Additional optimizationsHere's a list to keep track of the different areas where we need to align
|
The investigation that created this bug is |
Triage: this is a very big delay to page load time so we want to address it: P1. The remaining action items are to go through the checklist in #21530 (comment) and, for each use case, verify if the delay exists (i.e. the |
edit: see below. |
Nevermind. I accidentally tested the "needs new engine session case" we haven't optimized yet. Here's a profile when we don't need a new engine session that shows this did not regress: https://share.firefox.dev/3yIguCM |
I measured an 800ms improvement on a Moto G5 when we address the GV issue so it is very much worth continuing to optimize this in fenix. |
See: #17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1807338 Change performed by the Move to Bugzilla add-on. |
Steps to reproduce
Expected behavior
Gecko is notified of page load immediately in
GeckoSession.load
.Actual behavior
Gecko seems to be delayed by 260+ms because
HomeActivity.load
is called 260ms beforeGeckoSession.load
: https://share.firefox.dev/3ATZEBuIn another profile to apple.com, this took 524ms: https://share.firefox.dev/3ulv15d Perhaps the time above was shorter because the code is JIT'd, the XML is cached, and stuff. And another 431ms on a Moto G5+: https://share.firefox.dev/3zM4gbk Maybe it bounces between them
I'm guessing the root cause is we call
HomeActivity.load
but we suspend rather than handling the request synchronously so the UI inflation happens and then we callGeckoSession.load
. It's also possible we need the browser fragment to call this in the current code.Device information
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: