How do you debug performance issues in an iOS app?
Instruction: Discuss the tools and methodologies you use for identifying and resolving performance bottlenecks.
Updated
Official answer
Start with a reproducible user task and a specific symptom: a slow cold launch, scrolling hitch, increasing memory, delayed network response or battery drain. Record the device, OS, build configuration, data size, network and thermal conditions. Establish a baseline using a representative optimized build on physical hardware; simulator results may help investigation but do not establish device performance.
Choose tools based on the symptom. Time Profiler helps identify CPU work; inspect the main thread and call tree, but remember that a long wait can come from I/O or synchronization rather than expensive computation. Allocations, Leaks and the memory graph help investigate allocation growth and ownership; a clean Leaks result does not establish that all memory use is appropriate. Use relevant networking, file activity, hangs and rendering instruments, with signposts around meaningful operations.
Form a hypothesis, change the smallest relevant part and compare the same workload before and after. For example, if decoding a large response blocks UI work, measure decode duration and move or reduce that work with explicit isolation and bounded concurrency; simply adding an async keyword is not proof that CPU work left the main actor. Also test cancellation, repeated navigation and slow or failed requests.
Track direct outcomes such as launch percentiles, hang rate and duration, frame hitches, peak memory, bytes transferred and task latency, segmented by relevant device and version. Add repeatable performance tests where practical and inspect shipping metrics through Organizer or MetricKit. DAU can provide product context but cannot identify or prove a performance improvement. Record regressions and measurement limits instead of promising that every optimization improves satisfaction.