Flutter · One codebase, native feel
How do you profile Flutter performance and find jank?
Short answer
Profile in profile mode on a real device, capture a timeline, and separate UI-thread build and layout cost from raster-thread drawing cost. Fix the dominant cost rather than guessing.
Debug mode is not representative because it disables optimisations and adds assertions. Profile mode keeps AOT compilation and most performance characteristics while enabling tracing. A sixty-hertz frame has about sixteen milliseconds of budget across the pipeline; a hundred-twenty-hertz frame has about eight.
flutter run --profile- Use DevTools Performance to inspect UI and raster thread timelines
- Enable track widget builds and rebuild stats to find excessive rebuilds
- Check whether jank is on the UI thread or the raster thread before changing code
- Use a physical device for representative GPU and thermal behaviour
- Measure a repeatable scenario and compare before and after with the same build mode
Common root causes
UI-thread jank often comes from large rebuilds, expensive build methods, synchronous JSON parsing or layout thrash. Raster jank comes from large images, saveLayer, shadows, blurs and shader compilation. Impeller reduces shader compilation stutter on supported platforms, but it does not fix oversized textures or overdraw.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How do you tell UI-thread jank from raster-thread jank?
- 2Why is debug mode unsuitable for performance conclusions?
- 3What does the rebuild stats view show?
- 4When would RepaintBoundary make performance worse?
Say it in the interview
I profile in profile mode on a real device and capture a timeline for a repeatable scenario. Then I separate UI-thread time for build and layout from raster-thread time for drawing. If builds dominate I look at rebuild scope and synchronous work; if raster dominates I look at images, layers and effects. I only keep an optimisation if the same measurement improves.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Flutter mock interview and get scored feedback on depth, clarity and confidence.