Startup time is the first thing every user experiences, and it gets slower without anyone noticing. Nobody decides to make the app slow to launch. A new SDK gets one line in the app delegate, a repository warms a cache on init, a library registers itself through a content provider. Six months later the splash screen stays up noticeably longer than it used to.

This post is a practical pass you can do in an afternoon on either platform: measure properly, find out what runs before the first frame, move what can wait, and add a guard so it doesn't creep back.

Decide what you are measuring

There are three kinds of launch, and only one of them really matters for this work:

  • Cold start: the process does not exist yet. The OS creates it, loads your code, runs your app initialization, and draws the first screen. This is the slowest case and the one to optimize.
  • Warm start: the process exists but the activity or scene has to be recreated.
  • Hot start: the app is brought back to the foreground with everything still in memory.

Also separate two milestones. Time to first frame is when something is on screen. Time to fully drawn is when the screen shows real content the user can act on. An app that draws an empty shell quickly and then spins for a while has only moved the problem. Track both.

Measure before you change anything

Without a baseline you are guessing, and startup numbers are noisy. Use a physical device, ideally a modest one rather than your newest phone, use release builds, and run several iterations. Write down the median, not the best run.

Android

For a quick check, adb force-stops and launches the app, then reports timing:

adb shell am start -W -S -n com.example.app/.MainActivity

Look at TotalTime. For repeatable numbers, use Macrobenchmark in a separate test module:

@RunWith(AndroidJUnit4::class)
class StartupBenchmark {
    @get:Rule val rule = MacrobenchmarkRule()

    @Test
    fun coldStartup() = rule.measureRepeated(
        packageName = "com.example.app",
        metrics = listOf(StartupTimingMetric()),
        iterations = 10,
        startupMode = StartupMode.COLD
    ) {
        pressHome()
        startActivityAndWait()
    }
}

To capture time to fully drawn in Compose, tell the system when the content is actually ready:

@Composable
fun HomeScreen(state: HomeState) {
    ReportDrawnWhen { state.items.isNotEmpty() }
    // ...
}

Macrobenchmark can also record a Perfetto trace for each iteration. Open one and read the main thread from process start to first frame. That trace is usually where you find the answer.

iOS

In Xcode, the Instruments App Launch template shows what happens during launch, broken into phases, with the main thread's work visible. For a repeatable number, add a launch test:

func testLaunchPerformance() throws {
    measure(metrics: [XCTApplicationLaunchMetric()]) {
        XCUIApplication().launch()
    }
}

Once the app ships, the Xcode Organizer's Launch Time metrics and MetricKit's MXAppLaunchMetric show what real devices see. Lab numbers tell you whether a change helped. Field numbers tell you whether users noticed.

Inventory everything before the first frame

Make a plain list of all work that runs before the first screen is drawn. On Android, check:

  • Application.onCreate() and everything it calls
  • Content providers in the merged manifest. Many libraries initialize themselves this way, and you only see them in the merged manifest view in Android Studio.
  • Your dependency injection graph, especially singletons created eagerly
  • The first activity's onCreate and the first composition

On iOS, check:

  • Your App struct's init, or application(_:didFinishLaunchingWithOptions:)
  • @StateObject and @State initializers on the root view, which run during the first render
  • The number of dynamic frameworks you embed, since each one adds loading work at launch
  • Any Objective-C +load methods or static initializers, your own or from dependencies

For each item, ask one question: does the first screen need this to exist? Most of the time the honest answer is no.

The usual culprits

  • Third-party SDK initialization. Analytics, ads, remote config, feature flags, attribution. Each one looks cheap. Together they often are not.
  • Synchronous disk I/O on the main thread. Opening a database, reading a large preferences file, or decoding a bundled JSON file to seed state.
  • Network calls that block the first screen. Waiting for remote config before showing anything turns a slow network into a slow launch.
  • Eager object graphs. A DI container that builds every repository and client up front, including ones for screens the user may never open.
  • Heavy first composition or first render. Large images decoded at full size, complex layouts built for content that is off screen.

Defer, don't delete

The main technique is sorting work into three buckets: must run before first frame, can run right after first frame, and can run when first needed. Crash reporting usually belongs in the first bucket, because you want it catching crashes that happen during startup. (If you are setting that up, our post on crash reporting and triage for a small app team covers the rest of that pipeline.) Most other things belong in the second or third.

On Android, keep onCreate minimal and push the rest onto a background scope:

class App : Application() {
    val appScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)

    override fun onCreate() {
        super.onCreate()
        CrashReporter.init(this)          // needed before anything can crash

        appScope.launch {
            Analytics.init(this@App)      // not needed for the first frame
            RemoteConfig.fetchAndActivate()
        }
    }
}

Check each SDK's documentation first. Some must be initialized on the main thread or before certain calls, and moving them can cause subtle failures. For library content providers you want to control yourself, the Jetpack App Startup library lets you remove an automatic initializer from the merged manifest and run it lazily:

<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    tools:node="merge">
    <meta-data
        android:name="com.example.SomeLibraryInitializer"
        tools:node="remove" />
</provider>

On iOS with SwiftUI, a similar split works well. Keep init small and start non-critical services once the first view appears:

@main
struct MyApp: App {
    init() {
        CrashReporter.start()
    }

    var body: some Scene {
        WindowGroup {
            RootView()
                .task {
                    await Services.startNonCritical()
                }
        }
    }
}

For anything only one feature needs, make it lazy: a lazy var in Swift, by lazy in Kotlin, or a DI binding that is only resolved when the screen is first created.

Platform-specific wins

Android

  • Baseline Profiles. These tell the runtime which code paths to compile ahead of time. Generate one with the Baseline Profile Gradle plugin and a BaselineProfileRule test that walks your startup path, then compare Macrobenchmark results with and without it.
  • R8 in release builds. Make sure minification and optimization are actually on. Less code means less to load.
  • Splash screen API. Use the official SplashScreen API so the system can show a splash immediately, but don't use setKeepOnScreenCondition to hide slow work. That only makes the wait look nicer.

iOS

  • Fewer dynamic frameworks. Where your package manager allows it, link dependencies statically, or look into mergeable libraries in recent Xcode versions. Check the result in Instruments rather than assuming.
  • Avoid work in +load and static initializers. They run before your code gets a chance to defer anything.
  • Keep the root view's state cheap. A view model that opens a database in its initializer will do so during the first render.

Keep it from regressing

A single optimization pass wears off over time. To keep the gains:

  1. Run the startup benchmark on a fixed device or emulator image on a schedule, or before each release.
  2. Record the median in a simple file or spreadsheet next to the version number.
  3. Agree on a threshold for investigating, based on your own baseline and noise level, not a number borrowed from somewhere else.
  4. Make "what does this add to startup?" a standard question when reviewing any new SDK.

A short checklist

  • Baseline measured on a release build, real device, several iterations
  • Both first frame and fully drawn tracked
  • Inventory of all pre-first-frame work written down
  • Each item sorted into before frame, after frame, or on demand
  • No network or large disk reads blocking the first screen
  • Baseline Profile generated (Android); dynamic framework count reviewed (iOS)
  • Regression check in place before the next release

Wrapping up

Faster startup rarely comes from one clever trick. It comes from being strict about what has to run before the first frame, and that list is usually much shorter than what the app does today. Measure first, write the inventory, defer patiently, and keep a number you can compare against at each release. The work is unexciting, but users notice the result every time they open the app.