O'Reilly logo

Swift Development with Cocoa by Tim Nugent, Jonathon Manning, Paris Buttfield-Addison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. 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 use your software or not. Many of our friends and family prefer to use Pages instead of Microsoft Word, because despite the relative lack of features in Pages, 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 can 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required