Thread
#compose
    Chris Fillmore

    Chris Fillmore

    11 months ago
    I have a
    LazyColumn
    with around ~75 items, including stickyHeaders, inside a bottom sheet, and the performance of
    LazyListState.animateScrollToItem()
    is noticeably bad. The animation is not smooth; it appears to just show a few frames before landing at the target index. Scrolling through the list manually otherwise works well enough. The items in the list have some state associated with them (they can be “favourited” (via a heart icon) or “toggled” (via a switch). They have other components which are visible (or interactive) conditionally. So they are perhaps relatively complex. Should I expect
    animateScrollToItem
    to be performant in this case? I’m wondering if others have encountered a similar situation. Thanks for the feedback.
    Adam Powell

    Adam Powell

    11 months ago
    do you notice a difference between animating programmatically and touch-flinging at a similar speed?
    Chris Fillmore

    Chris Fillmore

    11 months ago
    No, at least to me it appears similar when I animate vs fling.
    Actually, I tested some more and it seems inconsistent. Sometimes the fling looks ok (not perfectly smooth but not noticeably bad.)
    Adam Powell

    Adam Powell

    11 months ago
    Are you running a release build? Do you see this behavior the first few times and then it settles?
    Chris Fillmore

    Chris Fillmore

    11 months ago
    Yes I started testing with a release build after reading that that made a difference. I’m not sure I noticed much difference in release vs debug, but I’ll check again. What to make of the suggestion of setting
    minifyEnabled true
    and using
    proguard-android.txt
    instead of
    proguard-android-optimize.txt
    ?https://www.reddit.com/r/androiddev/comments/n61qxh/jetpack_compose_lazycolumn_laggy/h8b9c8m/?utm_source=reddit&utm_medium=web2x&context=3 I did test these changes but did not observe a noticeable difference.
    Adam Powell

    Adam Powell

    11 months ago
    If you notice it gets smoother after a few scrolls in the same run of the app you might be seeing jit compilation. We should be publishing some new docs soon on the baseline profile installation process we use such that end users generally never see this, and you can trigger the ahead of time compilation process manually for development testing
    If it doesn't get smoother after a few scrolls, then you'll probably want to investigate your composables that make up each item
    Chris Fillmore

    Chris Fillmore

    11 months ago
    Thanks for the feedback. I will probably circle back to working on this next week, since the component otherwise needs some input from a teammate.
    fabio.carballo

    fabio.carballo

    11 months ago
    just putting myself here - because I came looking for the exact same problem.