Fixing a launch time regression

Performance Senior Swift 5.0+ iOS 17+ Reviewed By Alok Singh

Order the steps

Put the investigation steps in order.

  • Find the slow phase: library loading, static initialisers or first-frame work
  • Record with the App Launch instrument and compare with the last good build
  • Reproduce a cold launch on a device with a Release build
  • Add a launch performance test to CI
  • Defer or remove the work, such as lazy SDK start-up
Hint 1 of 1

Measure before changing anything.

Choose an answer, then open Show answer below to check it.

Show answer

Answer: C B A E D

  1. Reproduce a cold launch on a device with a Release build Field-like conditions give real numbers.
  2. Record with the App Launch instrument and compare with the last good build The comparison shows what changed.
  3. Find the slow phase: library loading, static initialisers or first-frame work Each phase has a different fix.
  4. Defer or remove the work, such as lazy SDK start-up Only the first frame's essentials should run at launch.
  5. Add a launch performance test to CI It catches the next regression early.

30-second answer

Reproduce on a device with a Release build and measure with the App Launch instrument, comparing against the last good build. Look at the three phases: loading dynamic libraries, static initialisers, and work done before the first frame in app delegate, scene or first view setup. Defer non-critical SDKs and work, reduce dynamic frameworks (or use mergeable libraries), and add a launch test to CI.

Practise saying it · 60 s. No recording, just a timer

Walk through a launch regression.

Say your answer out loud, then check which of these points you covered:

  • Reproduce cold
  • App Launch instrument
  • Find the phase
  • Fix and guard

Deep dive

XCTApplicationLaunchMetric in a performance test catches regressions.

Organizer and MetricKit show real-world launch times.

Warm and cold launches differ; measure cold.

Bisect commits if the cause isn't obvious.

Common mistakes

  • Measuring warm launches only.
  • Initialising every SDK in didFinishLaunching.

Senior take & follow-ups

Seniors measure, find the phase, fix and then guard with a test.

Follow-up questions

Think of your answer first, then open the hint.

  1. What are mergeable libraries?

    Show hint

    Dynamic frameworks merged at build time to cut load cost (Xcode 15).

  2. How do you stop regressions?

    Show hint

    A launch performance test in CI with a baseline.

Suggest a fix if something here is wrong or out of date.