Hi here… I’m trying out hybrid of RecyclerView and...
# compose
e
Hi here… I’m trying out hybrid of RecyclerView and ComposeViewHolder.. but looks like everytime it binds, it
setContent
, cause to it be slower. The profile looks as the image below. How can it be speed up? FYI, the detail question in. https://stackoverflow.com/questions/69514265/how-to-make-recyclerview-with-composable-viewholder-render-faster
a
Are you running a release build with R8 enabled?
e
I have
minifyEnabled true
, and see the below triggered. So I believe R8 is enabled. The result is the same.
s
Note that debug builds are considerably slower than release builds and you should never do perf optimisation based on debug builds, especially when it comes to Compose
w
If you don’t have to do this, I would suggest against it. In my experience, multiple ComposeViews is indeed reasonably slower to render than a single ComposeView or XML. In my testing, what you’ve described is one of the slowest ways of doing Compose. Is there any reason you don’t want to use LazyColumn?
e
It’s partly we can do incremental migration of a big live project. True, having LazyColumn would be ideal.
z
You can also put Android views in composables so you could still do incremental migration
w
I’d say you’ll have better luck converting the full content of your RecyclerView one RecyclerView at a time. The more ComposeViews on a screen at a time, the worse the performance is (it’s not a deal breaker, but if you’ve got a bunch of them it’ll probably be noticeably slow, even on production builds).