Chapter 16. Instruments and the Debugger

As anyone who’s written software knows, designing and implementing the features of an application is only a fraction of the work. Once the app’s done and performs all the tasks it’s meant to do, you need to make sure that it runs well.

Performance is a feature that many developers neglect, but it’s something that influences people’s decisions to buy your software or not. Many of our friends and family prefer to use Pages instead of Microsoft Word, because despite Page’s relative lack of features, it’s a more nimble and zippy application.

Not paying attention to performance also has more tangible implications for your code. For example, an application that is careless with memory will end up being force-quit by the system on iOS, and an app that consumes lots of CPU time will exhaust your user’s battery and make the system run hot. There are other resources as well that your application needs to be careful with, including network bandwidth and disk space.

To help monitor your application’s performance and use of resources, the developer tools include Instruments, an application that’s able to inspect and report on just about every aspect of an application.

Instruments works by inserting diagnostic hooks into a running application. These hooks are able to do things like analyze the memory usage of an application, monitor how much time the app spends in various methods, and examine other data. This information is then collected, analyzed, and presented ...

Get Learning Cocoa with Objective-C, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.