7

I am trying to create one compose screen with nested scroll behaviour. For that I am using lazyColumn as parent and inside that I do have multiple rows with layRow.

val scrollState = rememberLazyListState()
LazyColumn(
    state = scrollState,
    modifier = Modifier
        .background(Color.White),
)
{
    items(100, key = { it })
    {
        LazyRow(
            contentPadding = PaddingValues(start = 16.dp, end = 16.dp),
            horizontalArrangement = Arrangement.spacedBy(10.dp)
        ) {

            items(10, key = { it }) {
                Text(text = "Text $it")
            }
        }
    }
}

I am getting lagging behaviour when I scroll the list. I tried to create release build and saw some improvement but the behaviour is still show some junk behaviour. Behaviour is different on different types of devices.

I tried to use Column as parent view and saw good improvement but it loads all the views in list together. Which cost some other delaying issues.

When I did macro-benchmarking found plenty of junky frames. Majority of them are requesting for render operation.

enter image description here

enter image description here

Any optimisation suggestion here?

nilkash
  • 7,408
  • 32
  • 99
  • 176
  • What is the data size you used? Is it heavy UI with full images? Or this is happening with the basic code that u shared? – Mohanakrrishna Mar 27 '23 at 11:03
  • It is happening with the basic code which I have shared. The junk frames data is also for the same. – nilkash Mar 27 '23 at 11:52
  • Can you try with your release builds once? I found this topic at the end of the lazy column page and figured out that sometimes it’s poor on performance during debug build but somehow it’s optimised on release https://developer.android.com/jetpack/compose/lists#measuring-performance, weird but something to give it a shot! – Jeel Vankhede Mar 29 '23 at 06:56
  • Also see if R8 optimisation is in place or not. – Jeel Vankhede Mar 29 '23 at 06:58
  • @JeelVankhede I tried in release build and there is some improvement in release build. But still it is not performant as recycler view. I can still see some frame drop logs in release build as well. R8 is also enabled. – nilkash Mar 29 '23 at 08:53

0 Answers0