Hello here! I would like to use Compose in one of ...
# compose
g
Hello here! I would like to use Compose in one of my professionnel project with a large code base but I have a huge performance impact when I’m using a LazyColumn with a pretty simple row (a Row with some texts inside). Attached to this message, you can find an example on a OnePlus 7T with the GPU usage overlay but it is worst on a Motorola G8 Plus where it is just not usable... We extracted the list on an external project where it is better but we have always a lag on some devices (Motorola G8 Plus impacted). Here the GitHub repository if some of you want to check the source code: https://github.com/adrienbusin/TestComposeLags For information, yes the build is in debug but it is clearly not better with a release version...
Here the execution of the GitHub project in debug (the first app) and in release (the second app) on the Motorola G8 Plus.
Here the execution of the first video but in release mode and on a OnePlus 7T. A little bit better but performance still not good.
s
Are you running a debug or release build? might wanna take a look at this: https://engineering.premise.com/measuring-render-performance-with-jetpack-compose-c0bf5814933
g
Yes, like mentioned in my first message. Performance is bad in debug and release mode. First video is an example in debug, the last one in release. 😕
👍 1
g
Thanks @Albert Chang, didn’t have the information about R8 builds but I think it isn’t normal to have this huge performance impact on debug and release mode. Some list can be used even in these modes without an optimized build and in my case, I show only a list with a Row and some texts... R8 build shouldn’t be necessary just to show 50 elements.
👍 3
z
@gpaligot Which version of compose are you using? I saw some issues myself.
g
1.0.5
g
I get 60fps in your sample app (even without any optimisations) so i'm assuming the problem hasn't been captured fully there. You could try adding a bunch of logs to your real code to see exactly what's being recomposed when you scroll (presumably it's a lot to see perf like this)
a
Well it is normal in Compose UI.
z
@gpaligot I think the regression started showing up after 1.0.4, theres a report of it here. In my case, about 3% of users notice it - most running on lower end devices, but Ive also seen it on a pixel 2 and 6.
g
@Zoltan Demant Thanks for your issue. It describes pretty well my performance issue. When I have more than one text inside a Row, performance is really bad.
@grandstaish My FPS seems pretty good too but the GPU usage is really bad, even with the sample app.
@Albert Chang Not sure why it is normal. 🤔
e
Did you try a release build again with R8 enabled?
g
Yes, the performance is bad too. 😕
z
Please file a bug and link your sample project and data that you linked here. Tracker link is in channel topic
s
I'm not sure, but it might involve the recomposition process here. LazyList state holds a bunch of parameters that update during list scroll, which would cause a recomposition of that composition group(underhood Compose machinery). Therefore, you recreate the entire list with items every time the LazyList state updates.
I have a test project to track the performance of the most popular Compose components. Among them is LazyList. And I did not notice any problems there.
z
@Sergey Y. If you have the time for it - try attaching
Modifier.clickable
to items in a list in your test project, the underlying focus behavior seems to be whats causing issues.
z
@Sergey Y. Great! I saw that youre using
const val compose_version = "1.0.4"
, if you upgrade it to 1.0.5 and above, I think you will see way more lag when using the lists (Im running on
1.1.0-beta02
)
s
I have tests for every compose version
you can switch the branch or see the reports in the repository
opps, I didn't push the rest branches