App Startup Time Interview Questions
PERFORMANCE › Runtime
What's the difference between cold, warm and hot app starts?
What a strong answer covers: A cold start creates the process from scratch: Application.onCreate, then activity creation, layout and first frame. A warm start has the process alive but the activity must be recreated. A hot start brings an existing activity to the foreground. Cold start is the slowest and the one to optimise, with Play vitals flagging cold starts over 5 seconds.
How do you measure app startup time?
What a strong answer covers: Look for 'Displayed' in Logcat (time to initial display) and call reportFullyDrawn() for time to full display when content is ready. Use Macrobenchmark's StartupTimingMetric for repeatable measurements on a real device in release mode, Play vitals for real user data, and Perfetto system traces to see where the time goes.
What are the common causes of slow startup, and how do you fix them?
What a strong answer covers: Too much in Application.onCreate (SDK initialisation, DI graph creation, disk reads), libraries auto-initialising through content providers, heavy first-screen layouts, synchronous network or database calls before the first frame, and code running interpreted without a profile. Fixes: lazy or background initialisation, App Startup library to control ordering, deferring non-critical SDKs, the SplashScreen API, Baseline Profiles and R8.
What are Baseline Profiles and Startup Profiles, and how do you generate and verify them?
What a strong answer covers: A Baseline Profile lists hot classes and methods so ART AOT compiles them at install, improving cold start and early frames. A Startup Profile additionally guides R8 to put startup code in the primary DEX file. Generate them with the Baseline Profile Gradle plugin and a Macrobenchmark test that runs the startup and key journeys, commit the generated file, and verify the improvement by benchmarking with CompilationMode.None vs Partial.
Startup time regressed 30 percent between two releases. How would you find the cause?
What a strong answer covers: Reproduce with Macrobenchmark on both builds on the same device; compare Perfetto traces side by side to see which section grew (Application.onCreate, a content provider, inflation, first composition, class loading); check the diff for new SDKs, initialisers or dependency upgrades, a missing or broken Baseline Profile, or work moved to the main thread. Bisect commits if needed. Add a startup benchmark to CI so the next regression is caught before release.