Order the steps
Order the steps to fix janky scrolling.
- Fix the biggest cause, such as decoding on main
- Reproduce on a mid-range device with a release-like build
- Measure with Macrobenchmark FrameTimingMetric
- Measure again and compare
- Capture a Perfetto trace and find the long frames
Choose an answer, then open Show answer below to check it.
Show answer
Answer: B C E A D
- Reproduce on a mid-range device with a release-like build Debug builds lie about performance.
- Measure with Macrobenchmark FrameTimingMetric Get a number to improve.
- Capture a Perfetto trace and find the long frames See what each slow frame did.
- Fix the biggest cause, such as decoding on main One change at a time.
- Measure again and compare Prove the fix worked.
Illustrative, based on Compose and Android rules; not a device recording
Text version
| Frame | Work (ms) | Result |
|---|---|---|
| F1 | 9 | on time |
| F2 | 11 | on time |
| F3 | 10 | on time |
| F4 | 12 | on time |
| F5 | 9 | on time |
| F6 | 10 | on time |
0 dropped frames at 60 Hz (16.7 ms budget); ANR dialog at 5 s: no.
| Frame | Work (ms) | Result |
|---|---|---|
| F1 | 10 | on time |
| F2 | 45 | ⏱ late (the next 2 dropped) |
| F3 | – | ✕ dropped (F2 still running) |
| F4 | – | ✕ dropped (F2 still running) |
| F5 | 11 | on time |
| F6 | 10 | on time |
2 dropped frames at 60 Hz (16.7 ms budget); ANR dialog at 5 s: no.