Aaron Waller
08/23/2022, 9:13 AMZoltan Demant
08/23/2022, 9:44 AMAaron Waller
08/23/2022, 9:45 AMZoltan Demant
08/23/2022, 9:46 AMAaron Waller
08/23/2022, 11:32 AMZoltan Demant
08/23/2022, 11:51 AMste
08/23/2022, 12:24 PMadb shell cmd package compile -r bg-dexopt com.example.application
and see if you still experience poor performance.
However, even after doing so, I still face a performance penalty if compared to XML - especially when quickly scrolling a LazyColumn
.Zoltan Demant
08/23/2022, 12:50 PMitem {}
stable/immutable? That made a huge difference for me, non stable meant 3 recompositions everytime the item became visible on screen; stable brought that down to 1. Usually its fine with 3 even, but if the items are complex it might take 5-10 ms to invoke the composable function, do that times 3 and you have lag.ste
08/23/2022, 2:49 PMCsaba Szugyiczki
08/23/2022, 2:57 PMZoltan Demant
08/23/2022, 3:06 PM@Stable
🙂ste
08/25/2022, 5:51 PMZoltan Demant
08/25/2022, 5:57 PMste
08/25/2022, 5:58 PMpainterResource
calls.
E.g.
From:
LazyColumn { items { Image(painterResource(id)) } }
To:
val painter = painterResource(id)
LazyColumn { items { Image(painter) } }
Column
counterpart has no problemsZoltan Demant
08/26/2022, 2:20 AMste
08/26/2022, 7:09 AMclickable
modifier from the `Image`s (second video). Otherwise, some jank still appears when the scroll is fast; but it's still a big improvement if compared to the starting scenarioZoltan Demant
08/26/2022, 8:58 AMste
08/26/2022, 9:03 AMZoltan Demant
08/26/2022, 9:10 AMste
08/26/2022, 10:03 AMLazyColumn
I useZoltan Demant
08/26/2022, 10:55 AMLazyColumn
is recomposed as youre scrolling. For example, in the RouteHandler, the targetState is a "complex" object, earlier I had an issue where AnimatedContent
animations were being triggered a lot more (but you cant actually see it, since the end result is the same) than expected. At the end of the day that resulted in 3x more recompositions, for everything inside the content block.
Ill let you know if anything else comes to mind, but for now thats all Ive got. Im sure you will work it out one way or another though! 💪🏽Tariyel Islami
08/26/2022, 11:21 AMZoltan Demant
08/26/2022, 12:12 PMitem {}
block. Im honestly not sure how expensive (or if it is at all) the call is, but seemingly theres a bit of work there, that would happen a lot as youre scrolling the list.Corey
08/26/2022, 3:48 PMZoltan Demant
08/26/2022, 5:29 PMste
08/26/2022, 5:47 PMZoltan Demant
08/26/2022, 5:50 PMste
08/26/2022, 5:53 PMZoltan Demant
09/08/2022, 10:16 AMFudge
09/27/2022, 1:55 PM