feat(android): Automatically call FullyDrawnReporter to improve production PGOs - #57799
Open
mrousavy wants to merge 1 commit into
Open
feat(android): Automatically call FullyDrawnReporter to improve production PGOs#57799mrousavy wants to merge 1 commit into
FullyDrawnReporter to improve production PGOs#57799mrousavy wants to merge 1 commit into
Conversation
Contributor
Author
|
Claude says you can inspect the generated profiles; Haven't tried myself though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Since Android 12 the Google PlayStore automatically profiles cold starts of new apps on user devices to optimize them for subsequent launches (affects JVM, not native).
This works most effectively if the app reliably calls
reportFullyDrawn()once its content has been... fully drawn.This is super hard to test isolated, but it should improve performance in production by making these PlayStore profiles more accurate, allowing Android to optimize production apps better as it understands when TTFD (Time-To-Full-Display) actually happens, which is hard to tell for Android in a non-native Android app (i.e. react-native, with asynchronous rendering and whatnot).
Since react-native renders the main UI asynchronously, I do expect this change to make a performance difference in production, but this is merely an assumption and not a tested claim.
Btw., this does not call
reportFullyDrawn()directly, but instead uses androidx'FullyDrawnReporter, which is collaborative - meaning this works well in brownfield apps and apps can also extend this to register their reporter to delay their TTFD reporting.By default, it is enabled and reports on
CONTENT_APPEARED.I added a feature flag which allows users (brownfield?) to disable it by overriding
isFullyDrawnReportingEnabled()to returnfalse.Changelog:
[ANDROID] [ADDED] - Automatically call
FullyDrawnReporterto improve production performance via profilesTest Plan:
Isolated
Make sure
reportFullyDrawn()is called:Before this PR you'll see something like
After this PR you'll see something like
too.
Production
Ideally PlayStore can optimize the bytecode better with more accurate TTFDs, and startup time should decrease, but that is speculation.