~/talk

The ViewModel Performance Trap: When State Management Bites Back

Talkat AndroidMakers by droidcon 2026 · on Thursday, 2026-04-09· at 16:20· [frontend-architecture]
slides:none on file

Argument: ViewModel misuse causes real startup and rendering latency — init blocks, eager DI, reflective JSON parsers and deprecated Retrofit paths create hidden work (10–20 ms per parser, thousands of lazy injections in one app) that delays first frame. Detection uses Perfetto traces and method-sampling plus logs and custom metrics. Fixes that work include pass a custom CoroutineScope into ViewModel to avoid mainImmediate, warming expensive dependencies and early prefetch cuts TTI by 300–600 ms when applied.

AI-written summary · about

  1. 0:00Introduction
  2. 1:50What is a ViewModel
  3. 4:16Misusing ViewModels
  4. 9:31ViewModel performance sampling
  5. 13:01Eager dependency costs
  6. 16:12Abusing init blocks
  7. 20:47ViewModel scope and coroutines
  8. 23:57Customizing ViewModel scope
  9. 26:23Fetching beyond init
  10. 30:55Prefetching during navigation
  11. 33:00Myth of coroutine parallelization
  12. 35:48ViewModel as state holder
  13. 37:55Measuring perceived performance
  14. 39:21Q&A
  15. 41:52Q&A: Dispatcher switching
  16. 45:20Q&A: IO dispatcher use
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.