Jetpack Compose Debugging to fix performance problems
by
Yu Tanigawa
×
Copy
Open
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Slide 1
Slide 1 text
Jetpack Compose Debugging to fix performance problems Yahoo Japan Corpora+on Android App Developer, Yu Tanigawa © Yahoo Japan
Slide 2
Slide 2 text
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
Slide 3
Slide 3 text
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
Slide 4
Slide 4 text
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
Slide 5
Slide 5 text
Agenda • RecomposiCon State in Debugger • Layout Inspector • DemonstraCon • Summary © Yahoo Japan
Slide 6
Slide 6 text
01. Recomposi-on State in Debugger © Yahoo Japan
Slide 7
Slide 7 text
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
Slide 8
Slide 8 text
Recomposi3on State in Debugger • Android Studio (Hedgehog) からデバッグツールでComposableの検証がし易 くなった • 「Recompositon State」というパラメータをデバッガで⾒れるようになった © Yahoo Japan
Slide 9
Slide 9 text
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
Slide 10
Slide 10 text
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
Slide 11
Slide 11 text
Recomposi3on State in Debugger • Unchanged • Changed • Uncertain • Sta.c • Unstable © Yahoo Japan
Slide 12
Slide 12 text
02. Layout Inspector © Yahoo Japan
Slide 13
Slide 13 text
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
Slide 14
Slide 14 text
Layout Inspector © Yahoo Japan
Slide 15
Slide 15 text
Layout Inspector © Yahoo Japan
Slide 16
Slide 16 text
Layout Inspector © Yahoo Japan
Slide 17
Slide 17 text
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
Slide 18
Slide 18 text
Layout Inspector • Recomposed Composable is highlighted in blue to visually confirm the extent of the redraw. © Yahoo Japan
Slide 19
Slide 19 text
03. Demonstra-on © Yahoo Japan
Slide 20
Slide 20 text
Demonstra3on In this demonstraCon, I will add items to head of items list. © Yahoo Japan
Slide 21
Slide 21 text
Demonstra3on a © Yahoo Japan
Slide 22
Slide 22 text
Demonstra3on a © Yahoo Japan
Slide 23
Slide 23 text
Demonstra3on Pass ITEM ID as the key in LazyVerCcalGrid items. © Yahoo Japan
Slide 24
Slide 24 text
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
Slide 25
Slide 25 text
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
Slide 26
Slide 26 text
Demonstra3on © Yahoo Japan
Slide 27
Slide 27 text
Demonstra3on © Yahoo Japan
Slide 28
Slide 28 text
04. Summary © Yahoo Japan
Slide 29
Slide 29 text
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
Slide 30
Slide 30 text
© Yahoo Japan Thank you for listening!