Jank & Rendering Interview Questions
PERFORMANCE › Runtime
What is jank, and what is the frame budget on Android?
What a strong answer covers: Jank is visible stutter when frames miss their deadline. At 60 Hz each frame has about 16.7 ms, at 90 Hz 11 ms and at 120 Hz about 8 ms, for the main thread to process input, animate, measure, lay out and record drawing, and for RenderThread to send it to the GPU. Missing the deadline drops the frame.
What are common causes of jank in Android apps?
What a strong answer covers: Work on the main thread (I/O, parsing, image decoding), expensive layouts (deep hierarchies, nested weights), too much recomposition or rebinding in lists, overdraw, allocations causing GC, large bitmaps uploaded to the GPU, and first-time code running interpreted or classes loading during scroll.
How do you measure and find jank?
What a strong answer covers: Profile GPU Rendering bars and the JankStats library for quick feedback; Macrobenchmark FrameTimingMetric for repeatable numbers; Perfetto system traces to see what the UI thread and RenderThread did in slow frames; Layout Inspector recomposition counts for Compose; Play vitals for slow and frozen frames in production. Always test release builds.
How does Android render a frame, from VSYNC to the screen?
What a strong answer covers: Choreographer receives a VSYNC signal and runs callbacks on the UI thread: input, animation, then traversal (measure, layout, draw), where the View or Compose tree records drawing commands into a display list. RenderThread syncs the display list, issues GPU commands through Skia or HWUI, and queues the buffer to SurfaceFlinger, which composites layers for the display. Delays in any stage cause dropped frames.
A list scrolls smoothly on flagship phones but janks on mid-range devices. Walk me through how you'd diagnose and fix it.
What a strong answer covers: Reproduce on a real mid-range device with a release build; record a Perfetto trace while scrolling and find long frames; see whether the UI thread (binding or composition, layout, image decoding, GC) or RenderThread and the GPU (overdraw, large textures, shadows) is the bottleneck. Fixes: stable keys and models, moving formatting out of bind, sizing images, flattening layouts, reducing overdraw, prefetching, and adding a Baseline Profile covering scrolling. Benchmark before and after with FrameTimingMetric.