Gotta Go Fast (A Performance and Instruments Talk)

updated 9 months ago; latest suggestion 9 months ago


If you've been working on an iOS app for a while, you may have noticed that over time your once snappy app has started to feel a little sluggish. Your feed limps along with the occasional stall or maybe you're trying to build a camera app but it seems to lag quite a bit behind reality. Contrary to popular opinion, our software is becoming increasingly demanding at a rate that easily exceeds how quickly our devices are improving.

When the day of poor performance inevitably comes upon you, will you be ready to face it? Or will you resign yourself and your users to a subpar experience as you shrug your shoulders and watch your app's performance suffer more with each new feature?

The talk explains how to track overall performance, find performance problems and how to fix a few big ones. Sprinkled throughout are tasteful Sonic references along with 10 Rules for Good Performance. Let me know if I need to list each rule out!

The Outline

In this talk I cover:

What is Good Performance

There's a difference between overall speed and your app's responsiveness. Blocking the main thread (the render thread) can cause frames not to be drawn (aka a dropped frame) Dropped frames are a good indication of when parts of your code are going too slowly and can be improved via concurrency or removing blockers. You can use a CADisplayLink to track and log dropped frames along with their timestamps which will allow you to track down their cause later.

How Can I Find and Fix Problems

You can use Time Profiler to find out which methods your code is spending most of its time on as well as zero in on exactly what was happening when your app dropped a particular frame.

Once you've tightened things up as much as you could, you can use the Core Animation Instrument to check for code you may have written that is indirectly slowing your performance by triggering extra GPU work you don't need.

Finally, you can use Activity Trace to measure and monitor particular long running operations across threads and get a visual graph of what is happening in your system.

Bonus Round!

Finally, I wrap things up by going into some common tough bottlenecks that will slow your app down and give a couple rules for how to avoid these pitfalls.


  • The proposal author responds 9 months ago

    So that's a fair thought, but this talk is about performance in general.

    The reason I focus on "frames" is because in iOS specifically, all the code you write is executed on the Main Thread by default. This happens to also be the render thread, so slow performance can easily manifest itself as "dropped frames" even if the offending code has absolutely nothing to do with "graphics".

  • 8f060d3e981416a538d31896c2040ba09bb64443?size=100x100 8f060d3e981416a538d31896c2040ba09bb64443 suggests 9 months ago

    The mention of frames hints that this is not about general performance but graphic performance - which is quite a narrow subset of computing. I wonder how this affects the scope of these 10 rules for good performance.

  • 8b2f2d3e6553c2b4048b93300959895ab76b4154?size=100x100 8b2f2d3e6553c2b4048b93300959895ab76b4154 suggests 10 months ago

    I always feel like I don't know how to use Instruments as well as I should. So a talk like this would be great.

  • The proposal author responds 10 months ago

    Yep exactly. I'll update the title in here so that's more obvious

  • 9aa7ce9a7221485eeaa04683d137c15ef266c2dd?size=100x100 9aa7ce9a7221485eeaa04683d137c15ef266c2dd suggests 10 months ago

    So this seems like a performance measuring and Instruments talk..?