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

Ville Orkas

10/24/2023, 9:20 AM
How is it possible that when we have a scrollable regular
Column
that fills the screen with content the scrolling performance is very bad. But when we switch to an
AndroidView
that just contains a
ScrollView
and the content of the page wrapped in
LinearLayout
that contains a few
ComposeView
elements that render the same exact content as the full Compose solution, the scroll performance is much smoother. What is Compose doing in this case that is causing so much overhead?
e

efemoney

10/24/2023, 9:28 AM
Share the code for both…someone might be able to spot why its not as performant. (Check that youre not comparing apples to oranges by making sure this is done on a release build)
v

Ville Orkas

10/24/2023, 10:13 AM
Yes its a release build, but the hardware we are using is old (10+ years) and only running Android 5.1.1. We've tried to optimize this for ages but our conclusion is that its just something inside Compose that is causing the overhead and we cannot do anything to it ourselves.
e

efemoney

10/24/2023, 10:14 AM
Okay makes sense. I think sharing the code here might be helpful
v

Ville Orkas

10/24/2023, 10:15 AM
I dont think the code matters here, you can just imagine scrolling a page with the usual stuff: images, text, buttons, horizontal scrollers etc. Nothing special.
e

efemoney

10/24/2023, 10:17 AM
Well not sure what else to suggest other than, say, you might need to profile both implementations and see just where most of the UI thread time is spent.
v

Ville Orkas

10/24/2023, 10:19 AM
I wish profiling would tell us something. And if it did, it would be inside Compose internals.
k

Kata

10/24/2023, 2:17 PM
Scroll performance can be bad if your view recomposes a lot
v

Ville Orkas

10/24/2023, 2:18 PM
We have checked, there are no unnecessary recompositions
Or constant recomposition
d

dorche

10/24/2023, 4:29 PM
The only way for people to help would be if you could share 2 minimal examples, maybe even video recording of both. Also if you raise an issue on the issuetracker a lot of people would +1