~/talk

Jetpack Compose: Drawing without pain and recomposition

Talkat droidcon London 2024 · 2024-10-31..11-01· [android]
links:none on file
slides:none on file

Jetpack Compose performance improves by deferring state reads out of composition into measurement or drawing so rapid animations don’t trigger full recomposition; replacing alpha modifier with graphicsLayer or reading animated DP inside a custom layout/measure block eliminates per-frame recomposes, and switching animateColorState consumption into a draw lambda avoids repeated composition. Memory fixes include caching brushes and using canvas.translate to stop creating thousands of LinearGradient objects, and reusing FloatArray/native canvas drawPoints instead of boxed Offset lists to avoid ~779k allocations during particle animations. defer reads to measurement/draw phases cache brushes and translate canvas use native float arrays for drawPoints

AI-written summary · about

  1. 0:00Jetpack Compose optimizations
  2. 3:15Compose phases
  3. 5:04Recomposition triggers
  4. 6:29Alpha animations with GraphicsLayer
  5. 8:41State reads in phases
  6. 11:59Defer state reads
  7. 14:05Height animation measurement
  8. 17:41Background color animation
  9. 21:12Phase changes for performance
  10. 22:39Lottie animations and recomposition
  11. 25:08Icon recomposition in top bars
  12. 28:27When to optimize recomposition
  13. 28:51Memory with shimmer effects
  14. 32:23Particle systems memory
  15. 35:39Optimizing drawPoints
  16. 38:26Summary & Q&A
~/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.