Profiling & Performance
for fun and profit
Greg Heo (@gregheo)
11 January 2012
Hi there! @gregheo at the keys. These are the slides and presentation notes from my #iOSTO talk.
Please feel free to get in touch if you have any questions or comments.
Slide 2
Slide 2 text
Survey
•Developers?
•Instruments users?
•Profiling enthusiasts?
Survey shows: lots of developers; some instruments users (mostly using the “Leaks” tool); and only
a handful of time profiling users.
Slide 3
Slide 3 text
Why to not Profile?
•You might not need to!
iOS users demand excellent performance. Credit goes to Apple for a well-performing API too. We
developers have very few excuses for poor performance.
Slide 4
Slide 4 text
“Great programmers ship.”
– Managers everywhere
Slide 5
Slide 5 text
Why Profile?
•The app is slow!
Refactoring code (especially other people’s code) is what programmers love doing. Resist! Think
bug/feature regression and possible delays.
Slide 6
Slide 6 text
“Premature optimization
is the root of all evil”
– Knuth
Knuth said it. Enough said.
Slide 7
Slide 7 text
“Measure twice, cut once”
– carpenters?
You must have an objective measure. Re-factor and optimize the bottlenecks and hotspots to get
the most value in terms of programmer time invested vs. outcome.
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
Items to note: the playback/recording metaphor; the purple chart shows
CPU usage.
Slide 11
Slide 11 text
“Hide system libraries” is handy to hide all those pesky objc_msgSend() calls.
Slide 12
Slide 12 text
The high-level call tree view.
Slide 13
Slide 13 text
Annotated code view. Very handy.
Slide 14
Slide 14 text
Summary
•Profile, fix, profile again.
•Ship the app already.
Profile before and after to verify performance has indeed improved. Use the tools; they’re there to
help!