Discovering Bottlenecks with Instruments

To properly debug and improve your apps, you need to understand what tools are available to you. One of the tools Apple ships as part of Xcode is called Instruments. Instruments contains a collection of measurement tools that help you to profile and analyze your app to debug and detect complex problems or performance bottlenecks. For example, Instruments can help you figure out whether your app is suffering from memory leaks. Tracking a memory leak without the right tools is tedious and nearly impossible. A tool such as Instruments can help you track down several possible causes for a memory leak, which can save you a lot of time.

In this chapter, we're going to look at an app named Mosaic. This app is a straightforward app that was built to demonstrate how you can profile your app. The app is very slow; the longer it's used and the more the user interacts with the app, the slower the app becomes. You will learn how you can use Instruments to find the problems in Mosaic so you can eventually fix them, so the app runs smoothly.

To wrap this chapter up, you'll learn about a feature that is brand new in Xcode 10: Custom Instruments. With Custom Instruments, you can add your own measurements and visualizations to Instruments. This enables you to build tailor-made profiling tools that are perfect for your own app or framework.

This chapter is divided into the following segments:

  • Exploring the Instruments suite
  • Discovering slow code
  • Closing memory leaks
  • Building your own Instruments

By the end of this chapter, you'll be able to analyze your apps to find potential issues and solve them before they become a problem.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.48.62