View performance deep dive
summary
A sample RecyclerView app (cat photos) is profiled with CyTrace on Nexus 5 (Android 4.4) to break down create / bind / measure / draw work; text measurement and display-list creation dominate jank. Replacing view subtrees with drawables and custom text layout collapses nodes and cuts main-thread work — measured ~0.9 ms RecyclerView scroll, draw averages 3 ms and background text measurement stays under 7 ms — and moving text measurement off the UI thread via Litho off-main-thread text measurement yields sustained 60 fps; tradeoffs include accessibility, focus, RTL and invalidate semantics.
AI-written summary · about
chapters (22)
- 0:00Introduction to scroll performance
- 1:13Understanding jank and RecyclerView
- 3:21Phases of a scroll event
- 4:03Time constraints for smooth scrolling
- 4:24Cost of view creation in RecyclerView
- 6:52Display lists and drawing optimization
- 8:57How display lists work in practice
- 12:08Practical performance examples
- 13:31Constraint Layout performance analysis
- 15:37Measuring recycled vs new views
- 18:27Worst-case performance with Constraint Layout
- 19:31Flattening view hierarchies with Drawables
- 22:19Optimizing ImageView with Drawables
- 22:59Text layout challenges and solutions
- 25:29Results of manual optimizations
- 27:16Drawbacks of Drawable-based UIs
- 31:54Introducing Litho framework
- 32:37Litho code example and benefits
- 35:07Offloading work to background threads
- 36:11Litho performance results
- 37:38Comparison of all approaches
- 38:18Q&A and closing remarks
related talks
23mHybrid apps performance (en)
37mUI profiling in examples. Where is my bottleneck?
45mHigh performance in Android
48mLet's sprinkle some #PerfMatters on our ViewGroups (fr)
45mGraywater: A Framework for Fast Scroll Performance
07mDebugging RN Android Performance
43mPerformance in a Kotlin World
45mFinding and Fixing Performance Problems
