what are the best practices to eliminate these gre...
# compose
d
what are the best practices to eliminate these green bars? i'm rewriting app with compose. the recyclerview version was pretty smooth, but i can't reach same smoothness with LazyColumn like widgets. as i understand it's somehow related to animations, but i disabled all possible animations (crossfade, content size etc). also yes, i'm using r8 and release mode
šŸ‘€ 1
f
That is a very broad question. Have you read the Compose performance doc?
d
yep. i simplified the layout as possible. even load local images to exclude loading lib problems
my recyclerview full of bells and whistles works much smoother (loading animations, content rescale on loading)
i
I think that one of the most important things in the Compose performance doc is about running in release mode. Is this a debug application or a release application? This is one of the most simple things that you can do to improve Compose performance, but I find that itā€™s also one of those things that people skip (because building in debug mode is the default in Android Studio). edit: I re-read the original post which says ā€œalso yes, iā€™m using r8 and release modeā€ right at the end, so this was a bit of a silly question to ask šŸ™ƒ
d
i always run in release mode since debug mode is near to unusable, especially on the emulator
i
Is that graph in the screenshot from a physical device or an emulator?
d
it's xiaomi redmi note 9 pro
i
When you say ā€œload local imagesā€, what exactly do you mean? Are you loading those from resource files?
c
I feel the best option would be to isolate a minimal repro and open a bug on the issue tracker. It is going to be very difficult to debug this without seeing some code.
d
Are you loading those from resource files?
yes
isolate a minimal repro
yep. trying to do it with minimal code.
i
What do the performance bars look like if you replace the Images with a
Box(modifier = Modifier.background(Color.Cyan))
? Iā€™m wondering if something could be loading on the main thread when it shouldnā€™t be?
s
l
open the layout inspector and check for any unnecessary recompositions during scroll
d
the thing is when i start layout inspector my app is crashing šŸ™‚
j
Not sure if youā€™d have already done this but here is the very small list. 1. use
keys
for lazy column 2. try to make image model
@Stable