profiling & performance for fun and profit
TRANSCRIPT
![Page 1: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/1.jpg)
Profiling & Performancefor 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.
![Page 2: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/2.jpg)
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.
![Page 3: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/3.jpg)
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.
![Page 4: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/4.jpg)
“Great programmers ship.”
– Managers everywhere
![Page 5: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/5.jpg)
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.
![Page 6: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/6.jpg)
“Premature optimization is the root of all evil”
– Knuth
Knuth said it. Enough said.
![Page 7: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/7.jpg)
“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.
![Page 8: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/8.jpg)
![Page 9: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/9.jpg)
![Page 10: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/10.jpg)
Items to note: the playback/recording metaphor; the purple chart shows CPU usage.
![Page 11: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/11.jpg)
“Hide system libraries” is handy to hide all those pesky objc_msgSend() calls.
![Page 12: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/12.jpg)
The high-level call tree view.
![Page 13: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/13.jpg)
Annotated code view. Very handy.
![Page 14: Profiling & Performance for Fun and Profit](https://reader033.vdocument.in/reader033/viewer/2022060205/55a1f2561a28ab070b8b45bf/html5/thumbnails/14.jpg)
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!