← All topics/Performance & optimization

Practical interview questions

Scenario-style prompts with sample answer outlines. Focus is on how you would design and reason in real codebases.

Question 5

App launch time

Cold launch is slower than expected. How do you improve it, and what mistakes do teams make?

Follow-ups

  • What should be deferred?
  • What should never run at launch?
  • How do you measure launch reliably?

Answer outline

Measure first, then address costs systematically — never optimize without a baseline:

  1. 1.Measure — Xcode Organizer > MetricKit will show real-world data on launches. The App Launch template in Instruments. Always compare before/after on the same OS and device.
  2. 2.Common costs — Obj-C +load methods and Swift static initializers run before main() and block launch silently; heavy singleton init, synchronous file I/O, network on the critical path, and large storyboard/nib graphs.
  3. 3.Defer — anything not needed for the first frame: feature flag fetches, analytics batching, secondary SDK init, cache warming. Run it async after the app is interactive.
  4. 4.Never at launch — blocking network for non-critical data, full DB migration that blocks UI without a progress indicator, debug-only work left in Release builds.
App Launch template in Instruments — dyld activity, CPU usage, and thread states
App Launch template in Instruments — dyld activity, CPU usage, and thread states

Principles

  • Interactive first — move everything else to async post-launch.
  • Lazy services behind protocols — pay the cost only when the feature is used.
Defer non-critical setup
func application(_:didFinishLaunchingWithOptions: _) -> Bool {
    Task { await RemoteConfig.shared.refresh() }
    return true
}

Follow-up angles

  • Plugin SDKs — each initialize adds dyld and static init cost; audit your dependency count.