Dropped frames and hitches

Performance Mid-level Swift 5.0+ iOS 17+ Reviewed By Alok Singh

Predict the output

On a 120 Hz ProMotion display, how much time is there per frame?

// 1 second / 120 frames = ?
Options
Hint 1 of 1

Divide one second by the refresh rate.

Choose an answer, then open Show answer below to check it.

Show answer

Answer: B About 8.3 ms

Correct. 1000 ms ÷ 120 ≈ 8.3 ms, and the app gets only part of that.

Why not the others?
  • A About 16.7 ms. That's the budget at 60 Hz.
  • C About 33 ms. That's 30 frames per second.
  • D About 4 ms. That would be 240 Hz.

30-second answer

A frame is dropped (a hitch) when the app or the render server misses the display's deadline: about 16.7 ms at 60 Hz and 8.3 ms at 120 Hz on ProMotion devices. Causes are main-thread work during scrolling or animation (decoding, layout, synchronous I/O) and expensive rendering such as offscreen passes. Move work off the main thread, cache layout, and simplify layers.

Practise saying it · 45 s. No recording, just a timer

Explain hitches and how you fix them.

Say your answer out loud, then check which of these points you covered:

  • Frame budgets
  • Commit vs render hitches
  • Off-main work
  • Simpler layers

Deep dive

Commit hitches come from your app's work; render hitches from the render server.

The Animation Hitches instrument separates the two.

CADisplayLink.preferredFrameRateRange sets the rate for custom animations.

Decode images with preparingForDisplay() off the main thread.

Common mistakes

  • Assuming a 16 ms budget on ProMotion.
  • Synchronous image decoding in cellForRow.

Senior take & follow-ups

Seniors name both hitch types and the 120 Hz budget.

Follow-up questions

Think of your answer first, then open the hint.

  1. What is a commit hitch?

    Show hint

    The app took too long preparing a frame's layer changes.

  2. How do you find hitches in the field?

    Show hint

    MetricKit hitch rate and Organizer.

Suggest a fix if something here is wrong or out of date.