DevPrep

All topics › Performance

How do you profile an app in Instruments: Time Profiler, Allocations, Leaks, Hangs?

Middle PRO

Essence

Instruments answers "what is actually happening", not "what I think is happening". The main rule is measure first, then optimize: intuition about "slow spots" is wrong more often than you'd think. Profile a Release build on a real device (Product → Profile): Debug has no compiler optimizations, and the simulator runs on the Mac's CPU, showing neither real speed nor real memory limits.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store