O'Reilly logo

Mastering iOS 10 Programming by Donny Wals

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 21.  Offloading Tasks with Operations and GCD

The previous chapter showed you how you can use Instruments to measure your code's performance. This is a vital skill in discovering slow functions or memory leaks. You saw that sometimes it's easy to fix slow code and increase performance by simply fixing a programming error. However, the fix isn't always this easy. Some code simply can't be written quickly.

An example of this that you've already seen in this book, is networking. Whenever you fetch data from the network, you do so asynchronously. Not doing this would cause your code to hang for a lot longer than you'd want to, resulting in choppy scrolling and unresponsive interfaces.

Another example of slow code is loading an image from the ...

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