https://kotlinlang.org logo
#compose
Title
# compose
d

deviant

08/05/2022, 9:19 AM
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

Filip Wiesner

08/05/2022, 9:29 AM
That is a very broad question. Have you read the Compose performance doc?
d

deviant

08/05/2022, 9:31 AM
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

Isaac Udy

08/05/2022, 10:36 AM
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

deviant

08/05/2022, 10:38 AM
i always run in release mode since debug mode is near to unusable, especially on the emulator
i

Isaac Udy

08/05/2022, 10:40 AM
Is that graph in the screenshot from a physical device or an emulator?
d

deviant

08/05/2022, 10:41 AM
it's xiaomi redmi note 9 pro
i

Isaac Udy

08/05/2022, 10:42 AM
When you say “load local images”, what exactly do you mean? Are you loading those from resource files?
c

curioustechizen

08/05/2022, 10:43 AM
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

deviant

08/05/2022, 10:45 AM
Are you loading those from resource files?
yes
isolate a minimal repro
yep. trying to do it with minimal code.
i

Isaac Udy

08/05/2022, 10:47 AM
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

ste

08/05/2022, 12:20 PM
l

Lukáš Kúšik

08/06/2022, 9:17 AM
open the layout inspector and check for any unnecessary recompositions during scroll
d

deviant

08/06/2022, 12:09 PM
the thing is when i start layout inspector my app is crashing 🙂
j

jasu

08/08/2022, 4:35 AM
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
2 Views