0%
Mobile System Design Interviews: Architecture, Offline Sync, Networking, Media, Push and Performance
Performance and Battery on the Device
Performance in a mobile design interview is not about micro optimising loops. It is about understanding the few moments users actually feel: how long the app takes to open, whether scrolling stays smooth, whether the app gets killed in the background, how fast it drains the battery and how big it is to download. This lesson takes each of those in turn, with the mechanisms behind them and the tools that measure them. Image pipelines and media were covered in the media lesson, and background scheduling in the push and background work lesson, so here we refer to them only where they affect speed or energy.
Three kinds of start
A cold start happens when the app process does not exist. The OS creates the process, loads the executable and its libraries, runs initialisers, creates the application object, builds the first screen and draws the first frame. A warm start happens when some of that survives: on Android the process may still be alive but the activity must be recreated, or the system kept a saved state that must be restored. A hot start is bringing an app that is fully in memory back to the foreground; it should feel instant. Users experience all three, but cold start is the slowest and the one teams measure and improve first, because it is what every new user sees and what returns after the OS reclaims memory.
On Android, Google Play's Android vitals treat a cold start of about five seconds or more as excessive, a warm start of about two seconds and a hot start of about one and a half seconds, and these thresholds feed store quality signals. Aim far below them. On iOS, Apple's guidance has long been to show the first frame within roughly four hundred milliseconds so that the launch animation hands off cleanly. In a design interview, give a target and a percentile: first frame under one second at the 90th percentile on a mid range device is a reasonable product goal.
What happens before the first frame
On iOS, the dynamic linker loads frameworks, then static initialisers run, then your app delegate or SwiftUI App runs, then the first scene renders. Many dynamic frameworks and heavy static initialisers both slow the first phase, which is why teams merge frameworks and avoid work in load methods and global initialisers. iOS may also prewarm an app, running the early launch phases before the user taps, so measure from the user's tap or use the system's launch metrics rather than from process creation.
On Android, the system forks the process from the zygote, loads your classes, runs Application.onCreate and content providers, creates the launcher activity, inflates or composes its layout and draws. The classic problem is a bloated Application.onCreate: analytics, crash reporting, ads, feature flags, a dependency injection graph and a database all initialised eagerly, one after another, on the main thread.
Shortening the critical path
The approach is the same on both platforms: decide what the first screen strictly needs, run only that before the first frame, and defer the rest. Crash reporting should start early because it must catch startup crashes, but it is designed to be cheap. Analytics can queue events in memory and initialise after the first frame. Ads, chat widgets, experiment SDKs that do not affect the first screen and prefetching for other tabs can wait until the app is idle. On Android, the App Startup library lets you control initialiser order and make them lazy, instead of each library registering a content provider that runs at launch.
Next, make the first screen cheap. Render it from the local database or a small cached snapshot instead of waiting for the network; show a skeleton for anything that must be fetched. Avoid synchronous disk reads of large files on the main thread. Keep the first screen's view hierarchy shallow and its images sized to their views. If the first screen depends on remote config, use the cached values from the previous session and apply new values next launch, which also prevents the interface from changing under the user's finger.
Compiler and packaging help
On Android, code runs best when it has been compiled ahead of time. Baseline Profiles ship a list of classes and methods used during startup and common journeys, so the runtime compiles them at install time instead of interpreting or compiling them later; teams commonly report startup improvements of a quarter or more. R8 shrinking and optimisation reduce the amount of code to load. On iOS, fewer dynamic frameworks, link time optimisation where it helps, and avoiding Objective-C plus load methods and heavy Swift static initialisers reduce pre main time. Both platforms benefit from smaller binaries, which leads to the app size section later.
Defining done
Two milestones are worth naming. Time to initial display is when the first frame of the first screen is drawn. Time to full display is when the content the user came for is visible and usable, for example the feed with real items rather than a skeleton. Android exposes reportFullyDrawn so you can mark the second milestone, and you can add a matching custom signpost on iOS. Optimising only the first can hide a slow second: a quick skeleton followed by six seconds of spinner is not a fast app.
Warm and hot starts deserve attention too
Once cold start is under control, look at the other two. A slow hot start usually means the app does heavy work every time it returns to the foreground: refreshing every tab, re-reading large files, re-running a full sync or re-checking configuration synchronously. Make foreground work incremental and asynchronous, show what is already on screen immediately and let fresh data slot in. A slow warm start on Android often comes from expensive state restoration, such as rebuilding a large view hierarchy or re-querying a database on the main thread when the activity is recreated. Keep saved state small, identifiers rather than whole objects, and load the rest asynchronously.
There is also the start that users do not think of as a start: opening the app from a notification or a deep link. These paths often skip the normal home screen and go to a detail screen that was never optimised, or they wait for a full home feed load before navigating. Measure deep link launches separately and make sure the target screen can render from local data or a single request without waiting for unrelated screens.
Startup in cross platform apps
React Native and Flutter apps have an extra phase: starting the JavaScript or Dart runtime and loading the bundle or snapshot. Precompiled bytecode such as Hermes for React Native, ahead of time compilation in Flutter release builds, lazy loading of rarely used modules and keeping the first screen's dependency tree small all help. Kotlin Multiplatform shares business logic but uses native UI, so startup looks like a normal native app plus the cost of initialising shared modules. In an interview, mention the extra phase in one sentence and apply the same rule: only what the first screen needs runs first.
What the interviewer is checking
When an interviewer asks how you would make the app start faster, they want a method, not a list of tricks. Strong answers define the start type and metric, measure on a representative mid range device, identify what runs before the first frame, defer or parallelise non critical initialisation, render the first screen from local data and add a regression guard. Weak answers jump to rewriting the app in another framework or to adding a splash screen that hides the delay without shortening it.
The system splash screen covers the time until your first frame; it does not shorten it. Use it as designed, a brief branded handoff, and spend the effort on what runs before the first frame and on rendering the first screen from local data.