Your app startup time is a major indicator of your app’s overall quality; when your app is slow to launch, the user may expect the app to be slow or buggy as well. Conversely, a quick launch gives the impression that the rest of the experience will be smooth as well. So what is a cold start? And how long should your app startup take? We’ll explore these questions in this post.
What is a cold start?
Your cold app launch latency is the time between when your user launches the app from scratch and when it is responsive and accepting touch events. This is measured automatically when you are using Instabug App Performance Monitoring.
Since there are cold starts, you might infer that there are also warm starts and hot starts. These are the three types of app launches. Each refers to the state of the app in the user’s memory. For a more detailed breakdown, check out the article Understanding Cold, Hot, and Warm App Launch Time. Here’s a brief summary.
- A cold start happens when the user launches the app either for the first time since booting or after killing the application. All of the app processes are created from scratch. This type of launch is the slowest because the system has a lot of expensive work to do.
- In a hot start, your app’s process is already running in the background and the system brings it to the foreground. The application and activity are kept in memory. Only the view must be rendered. This is the fastest launch time because it is simpler and less intensive than a cold launch.
- During a warm start, your app performs some of the cold start tasks even if the process is already running in the background. For example, this could happen when a user backs out of your app but launches it again.
App launch benchmarks
The Android Developer Guide currently considers the following startup times to be maximums for acceptable performance:
- Cold launches should take less than 5 seconds
- Hot launches should take less than 1.5 seconds
- Warm launches should take less than 2 seconds
Cold app launch stages
A cold app launch is a multi-stage process that includes several phases. If your APM tool gives you visibility of your separate app launch stages, that will make slow startups easier to debug.
The precise breakdown of the cold app launch into stages differs by OS, but here’s a general overview of what happens during a cold app launch: the operating system creates the app process, then the app object, and launches the main thread. Then your app creates the main activity, followed by view inflation, layout, and draw. If you’re using Instabug, your Android and iOS launches are broken down into discrete stages with performance trends for each. You’ll be able to zero in on the source of slow launches.
Different developers will have different definitions of how app launch should be calculated and which activities it should contain, so Instabug’s EndAppLaunch API allows you to custom configure the end of your app launch. This defines when a cold app launch has ended, or when the app is actually interactable. That way, your actual launch duration is correctly assessed for your app.
iOS cold app launch stages
Here is a breakdown of the stages monitored by Instabug during cold iOS app launches.
- OS Operating system stage: It can generally take 100 or so milliseconds for the OS to do the system-side work in order to initialize the app.
- didFinishLaunchingWithOptions App lifecycle event: This method is called when your app is done loading and ready to be used. didFinishLaunchingWithOptions finalizes your app’s initialization and makes final adjustments. More info
- sceneWillEnterForeground App lifecycle event: This method will be called if the app is set up to use Scenes.
- viewDidLoad View lifecycle event: Called when the ViewController is loaded into memory. This when your customized initializations for your view controller are performed. More info
- viewWillAppear View lifecycle event: Called when the ViewController’s view is about to be added to the hierarchy. This happens before animations are configured. More info
- viewDidAppear View lifecycle event: Notifies the ViewController that its view was added to a view hierarchy. More info
- Content Loaded: When the EndAppLaunch API is used, this will be considered to be the end of your launch.
Android cold app launch stages
The following stages are monitored by Instabug during cold Android app launches.
- Application onCreate: This is called when the app is starting and the system creates the application object. More info
- First Activity onCreate: Your app creates the main activity. More info
- First Activity onStart: This method is called when the activity is started. More info
Decreasing your cold start duration
Here are a few tips you can use to make your cold app launch faster. For a more comprehensive list, check out App Launch Optimization: How to Resolve Slow Startup Times.
- Identify and monitor slow cold start stages with an APM tool
- Reduce memory usage by caching resources and computations
- Defer non-critical and expensive processes until after launch
- Test obsessively and in diverse environments
- Understanding Cold, Hot, and Warm App Launch Time
- Mobile App Network Performance Monitoring and Debugging Guide
- Mobile App Performance Metrics and KPIs
- Mobile App Quality: An Essential Guide
Instabug empowers mobile teams to maintain industry-leading apps with mobile-focused, user-centric stability and performance monitoring.