Menu

Your app starts slow after every update: generate a Baseline Profile and prove it is applied
📰

Your app starts slow after every update: generate a Baseline Profile and prove it is applied

DEV Community: kotlin·Charles Hartmann·25 days ago
#urDVcF6B
#devtokotlin#devto#dev#profile#device
Reading 0:00
15s threshold

A Baseline Profile is the single change most likely to make an existing Compose app start faster and scroll more smoothly without touching its logic. It is a list of the classes and methods your app needs on its most important paths, shipped inside the app, so the runtime can compile them ahead of time on install instead of discovering them slowly on the user's phone. This post generates one with the Baseline Profile Gradle plugin and then proves, three ways, that it is applied.

The trap

Your Kotlin compiles to DEX bytecode. The Android Runtime (ART) can interpret it, JIT-compile hot methods while the app runs, or run machine code compiled ahead of time (AOT). ART does not AOT-compile your whole app on install. It records which methods were used into a profile and compiles them later, when the device is idle and charging.

That works eventually, and "eventually" is the problem.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.