Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView #11660

Closed
MarcLeclair opened this issue Jun 16, 2020 · 1 comment
Assignees
Labels
performance Possible performance wins wontfix

Comments

@MarcLeclair
Copy link
Contributor

MarcLeclair commented Jun 16, 2020

Allowing to do so would save us ~100-150ms (time taken on a g5+). Note: the time on higher end device can be between 20-40ms.

I used nanoscope to profile a non debugabble build on start up (simpleperf is still struggling a bit right now so I used this), the UI isn't very friendly and works better on chrome at the moment. At ~1220656473ns in the profile, we can see the LiveData.setValue() callback after our first traversal. By prefetching our topsites, we'd be able to avoid this callback and show our topsites on the first layout pass.
noprefetch.html.zip

On top of that, we have an issue where we update our UI with the TopSites and collectionStorage through the call consumeFrom which triggers a coroutine. The hiccup here is that the launch isn't triggered right away on our UI thread which means that on our first view traversal, even though our data should be available, we don't update it there which means a slower start up since we have to wait for the consumeFrom callback.

Here's an image that depics this better. The first call stack on the right is our first traversal (so the firefox logo showing, the url bar on the bottom, etc...). Topsites will then get drawn after the livedata callback which occurs where the two lines intersect ( the gray box in the bottom left indicates that this triggers our topsite change with HomeFragment$onTopSiteChange

image

┆Issue is synchronized with this Jira Task

@MarcLeclair MarcLeclair created this issue from a note in Performance, front-end roadmap (In progress) Jun 16, 2020
@github-actions github-actions bot added the needs:triage Issue needs triage label Jun 16, 2020
@MarcLeclair MarcLeclair self-assigned this Jun 17, 2020
@MarcLeclair MarcLeclair added performance Possible performance wins and removed needs:triage Issue needs triage labels Jun 17, 2020
@MarcLeclair MarcLeclair changed the title Allow prefetching of topsite with observeForever. Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Jun 17, 2020
MarcLeclair added a commit to MarcLeclair/fenix that referenced this issue Jun 17, 2020
…nCreateView()

fixing lint

more linting

more linting

more linting fix
MarcLeclair added a commit to MarcLeclair/fenix that referenced this issue Jun 17, 2020
TopSites will be prefetched with observerOnce (wrapper around observerForever).
Also, the SessionControlView.update() is called right away instead of waiting from consumeFrom
in the HomeFragment.onCreateView() which will allow the UI to render all at once on its first
perform traversal
MarcLeclair added a commit to MarcLeclair/fenix that referenced this issue Jun 17, 2020
TopSites will be prefetched with observerOnce (wrapper around observerForever).
Also, the SessionControlView.update() is called right away instead of waiting from consumeFrom
in the HomeFragment.onCreateView() which will allow the UI to render all at once on its first
perform traversal
MarcLeclair added a commit to MarcLeclair/fenix that referenced this issue Jun 18, 2020
TopSites will be prefetched with observerOnce (wrapper around observerForever).
Also, the SessionControlView.update() is called right away instead of waiting from consumeFrom
in the HomeFragment.onCreateView() which will allow the UI to render all at once on its first
perform traversal
MarcLeclair added a commit to MarcLeclair/fenix that referenced this issue Jun 18, 2020
TopSites will be prefetched with observerOnce (wrapper around observerForever).
Also, the SessionControlView.update() is called right away instead of waiting from consumeFrom
in the HomeFragment.onCreateView() which will allow the UI to render all at once on its first
perform traversal
MarcLeclair added a commit that referenced this issue Jun 18, 2020
…11668)

* For #11660:added prefetch for topsites

TopSites will be prefetched with observerOnce (wrapper around observerForever).
Also, the SessionControlView.update() is called right away instead of waiting from consumeFrom
in the HomeFragment.onCreateView() which will allow the UI to render all at once on its first
perform traversal

* Removed the submitList(null) since it retriggered a drawing on lower end device
@liuche liuche mentioned this issue Jun 27, 2020
12 tasks
@MarcLeclair MarcLeclair moved this from In progress to Done in Performance, front-end roadmap Jun 29, 2020
@data-sync-user data-sync-user changed the title Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView FNX3-14803 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX3-14803 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView FNX-12636 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Aug 11, 2020
@data-sync-user data-sync-user changed the title FNX-12636 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView FNX2-13557 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Aug 11, 2020
@kbrosnan kbrosnan changed the title FNX2-13557 ⁃ Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Allow prefetching of topsite with observeForever and allow to update homefragment in onCreateView Aug 29, 2020
@stale
Copy link

stale bot commented Feb 25, 2021

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.

@stale stale bot added the wontfix label Feb 25, 2021
@stale stale bot closed this as completed Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Possible performance wins wontfix
Development

No branches or pull requests

1 participant