Home > Software design >  Performance of LazyColumn with LazyRows inside it
Performance of LazyColumn with LazyRows inside it

Time:01-16

I have a lazy column with lazy rows inside it, like in the image:

enter image description here

I am testing on a 2017 middle-quality phone with Android 9. Release build with R8 enabled.

Scroll performance in rows are pretty good, but in column performance is very low. I am using simplest composables, nothing special.

LazyColumn { 
     items(
          items = rows,
          key = { it.id },
          contentType = { it.type}
     ) { 
          LazyRow {
               items(videos) {
                    Video()
               }
          }
     }
 } 

CodePudding user response:

I had the same issue when playing with it months ago. I see some coworkers used ImmutableList for the items though and had better luck with that. Might be worth a try - the issue I had is that there was a ton of recomposition happening as well so make sure that is good with a profiler

CodePudding user response:

I have the same problem. But it occurs randomly. I used a structure like yours and it appears very smooth at beginning. But after I add some new feature to the screan, it becomes laggy sometimes. When I keep scrolling up and down, I can see it forzen for s split second sometimes. I've tried some sample apps from github with lazy features. They have the same problems. One thing for sure is that the debug mode does make the lazycolumn and lazyrow slow. Build an apk and see if it appears better.

  • Related