简体   繁体   中英

Performance of LazyColumn with LazyRows inside it

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

在此处输入图像描述

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()
               }
          }
     }
 } 

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM