Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jetpack Compose Debugging to fix performance problems

Jetpack Compose Debugging to fix performance problems

Yu Tanigawa

June 01, 2023
Tweet

Other Decks in Programming

Transcript

  1. Jetpack Compose Debugging to fix performance problems Yahoo Japan Corpora+on

    Android App Developer, Yu Tanigawa © Yahoo Japan
  2. About Me • I’m an Android app engineer at Yahoo!

    JAPAN since 2021. • I’m developing PayPay Flea Market and Yahoo! AucCon app. • I have been developing personal Android app since I was a student. © Yahoo Japan
  3. About Me • I’m an Android app engineer at Yahoo!

    JAPAN since 2021. • I’m developing PayPay Flea Market and Yahoo! AucCon app. • I have been developing personal Android app since I was a student. © Yahoo Japan
  4. Agenda In this session, I will recap about “Debugging Jetpack

    Compose” lecture of Google I/O 2023. h"ps://io.google/2023/program/a3ed5302-d787-41bd-8623-54193d36caf0/intl/ja/ © Yahoo Japan
  5. Recomposi3on State in Debugger • Android Studio Hedgehog or later

    can check the “RecomposiCon State” within the standard debugger • By checking the “RecomposiCon State”, it is possible to easily check the parameters that triggered the recomposiCon © Yahoo Japan
  6. Recomposi3on State in Debugger • Android Studio (Hedgehog) からデバッグツールでComposableの検証がし易 くなった

    • 「Recompositon State」というパラメータをデバッガで⾒れるようになった © Yahoo Japan
  7. Recomposi3on State in Debugger • Android Studio Hedgehog or later

    can check the “RecomposiCon State” within the standard debugger • By checking the “RecomposiCon State”, it is possible to easily check the parameters that triggered the recomposiCon © Yahoo Japan
  8. Recomposi3on State in Debugger • Android Studio Hedgehog or later

    can check the “RecomposiCon State” within the standard debugger • By checking the “RecomposiCon State”, it is possible to easily check the parameters that triggered the recomposiCon “isShowLikeBu-on” has Changed © Yahoo Japan
  9. Layout Inspector Pros • Debug the scrolling of lists and

    ViewPager without stopping the app • It is possible to intuiCvely understand the recomposiCon count only within this tool. • Visual confirmaCon of the recomposed area Cons • Unable to idenCfy the parameter that triggered the recomposiCon © Yahoo Japan
  10. Layout Inspector Recompose count: Indicates that the parameters have been

    changed and redrawn Skipped count: Count of skipped composiCons, assuming no difference in parameters © Yahoo Japan
  11. Layout Inspector • Recomposed Composable is highlighted in blue to

    visually confirm the extent of the redraw. © Yahoo Japan
  12. Demonstra3on Pass ITEM ID as the key in LazyVerCcalGrid items.

    items( items = items, key = { it.id } ) { item -> Item(item = item, isShowLikeBubon = isShowLikeBubon, onClickLike = onClickLike) } © Yahoo Japan
  13. Demonstra3on Pass ITEM ID as the key in LazyVerCcalGrid items.

    items( items = items, key = { it.id } ) { item -> Item(item = item, isShowLikeBubon = isShowLikeBubon, onClickLike = onClickLike) } © Yahoo Japan
  14. Summary • Android Studio Hedgehog or later can check the

    status of recomposiCons within the standard debugger • Layout Inspector provides a method to check recomposiCon and skipped count without stopping the applicaCon. • Layout Inspector allows you to visually and clearly see the recomposed area when data has changed. © Yahoo Japan