Rendering & jank

The 16ms/60fps (and 8ms/120fps) frame budget, overdraw, list recycling, and profiling with Systrace/Instruments. Fixing a janky list on a budget device is a favorite live task.

About 23 min read3-question knowledge check

The mental model

A phone screen is a conveyor belt that moves at a fixed rhythm. At 60Hz it advances every 16.67ms; at 120Hz every 8.33ms. On each tick the display grabs whatever frame is ready and shows it. Your job, every single tick, is to have the next frame finished and handed off *before* the belt moves. Jank is a missed handoff — the belt moves, your frame isn't done, so the previous frame is shown again. The user sees a stutter, a dropped frame, a hitch in a scroll that should be glass-smooth.

That reframes the whole problem: rendering performance is not "make it fast," it is "finish within the frame budget, every frame." An app that renders a frame in 4ms average but occasionally takes 40ms is janky — the average is irrelevant, the outliers are the whole story. This is why you profile tails (p90/p99 frame time), never means, and why "it's smooth on my Pixel" is not a claim about your users, whose budget phones have a slower CPU/GPU doing the same work in the same 16.67ms.

The one idea that explains almost every jank bug: the main thread (UI thread) is sacred, and anything that blocks it blows the budget. Layout, drawing, and input all happen on this one thread. If you decode a bitmap, run a synchronous query, do JSON parsing, or trigger a giant recomposition on it, that work eats into the 16.67ms you needed for the frame. The fix is almost always the same move in different clothes: get work off the main thread, and do less of it per frame. Decode images off-main, recycle list rows, cache what you computed, cut overdraw — every jank fix is a variation on "the belt is moving and you're still working."

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision