What is the best way to debug the startup time of ...
# compose
d
What is the best way to debug the startup time of a Compose app? To understand what happens before the first screen shows up?
a
We use http://ui.perfetto.dev to investigate performance cases
A great part about using the web perfetto tool is that if you have problem cases, you can link them here or in the issue tracker too 🙂
d
Great, thanks! I will look into it
👍 1
@Adam Powell I just noticed something strange in the app I am developing. The first few times I run the app after building/installing it on the device, it takes 1+ second for the first screen to show up. After many times I run it (using the same build), the first screen shows up instantly. I deleted any cache, I even restarted the device, and the first screen still shows up instantly. If I install a new build, then the first few times I run it, the first screen shows up with the 1+ second delay again. I guess there is some kind of optimisation that the Android OS does for the apps that are run many times?
If the app has been distributed through google play, cloud profiling should yield the effect you mention. I’m not sure if this also applies to APKs which were never distributed to the play store.
d
Interesting, I didn't know. But, yes, it's happening even for an app that I am just installing in debug version on my device. But it doesn't happen straightaway. It looks like maybe the Android OS is running an optimization once per day. I discovered it only today for a build I installed yesterday.
j
I remember that some versions of ART also did opportunistic AOT compiling of APKs, for example while charging at night. These behaviors changed several times thru the various Android versions though, I’m not sure what’s the current strategy.
a
yes, the profile-guided AOT compilation is likely to be what you're seeing. The device uses a combination of idle + charging status to determine when to do it.
d
It sounds great 👍