80 lines
2.6 KiB
Markdown
80 lines
2.6 KiB
Markdown
# 12. App Launch Time Optimization
|
|
|
|
meta:
|
|
id: ios-production-12
|
|
feature: ios-production
|
|
priority: P2
|
|
depends_on: []
|
|
tags: [performance, launch, production]
|
|
|
|
objective:
|
|
- Optimize app launch time to under 2 seconds for cold starts and under 1 second for warm starts
|
|
|
|
deliverables:
|
|
- Launch time measurement and baseline
|
|
- Optimized app initialization
|
|
- Lazy loading of heavy components
|
|
- Reduced binary size
|
|
|
|
steps:
|
|
1. Measure current launch time:
|
|
- Use Xcode Metrics Organizer
|
|
- Use os_signpost for custom timing
|
|
- Measure cold start (first launch after reboot)
|
|
- Measure warm start (subsequent launches)
|
|
- Establish baseline metrics
|
|
2. Optimize app delegate:
|
|
- Minimize work in application(_:didFinishLaunchingWithOptions)
|
|
- Defer non-critical initialization
|
|
- Move heavy setup to background threads
|
|
- Avoid blocking main thread
|
|
3. Lazy load heavy components:
|
|
- Defer VoicePrint model loading until needed
|
|
- Defer document scanner initialization
|
|
- Lazy load WebView components
|
|
- Load dashboard data after UI appears
|
|
4. Optimize storyboards/XIBs:
|
|
- Remove unused storyboards
|
|
- Minimize view controller initialization
|
|
- Use code-based UI where faster
|
|
5. Reduce binary size:
|
|
- Strip debug symbols from release builds
|
|
- Remove unused resources and assets
|
|
- Compress images in asset catalog
|
|
- Enable dead code stripping
|
|
6. Optimize framework loading:
|
|
- Link frameworks statically where possible
|
|
- Reduce dynamic framework count
|
|
- Prelink common frameworks
|
|
7. Add launch screen optimization:
|
|
- Simple, static launch screen
|
|
- Match first screen of app
|
|
- No animations or complex layouts
|
|
|
|
tests:
|
|
- Performance: Measure launch time on iPhone 12
|
|
- Stress: Launch app 100 times, average time <2s
|
|
- Memory: No memory spikes during launch
|
|
|
|
acceptance_criteria:
|
|
- Cold launch time <2 seconds on iPhone 12
|
|
- Warm launch time <1 second on iPhone 12
|
|
- Launch screen visible for <500ms
|
|
- No blocking operations on main thread during launch
|
|
- Binary size <100MB (App Store limit is much higher)
|
|
- Heavy components loaded lazily after launch
|
|
- Launch time measured and tracked in CI
|
|
- No crashes during launch under memory pressure
|
|
|
|
validation:
|
|
- Xcode Metrics → cold start <2s, warm <1s
|
|
- Instruments Time Profiler → no long blocking calls on main thread
|
|
- Physical device test → feels instant
|
|
- App Store Connect → binary size acceptable
|
|
|
|
notes:
|
|
- Launch time is critical for App Store review and user retention
|
|
- iOS may terminate apps with launch times >20 seconds
|
|
- Use pre-warmed launches for more accurate measurement
|
|
- Test on oldest supported device (iPhone SE 2nd gen or similar)
|