Accompanist-Pager had a offScreenPageLimit paramet...
# compose
a
Accompanist-Pager had a offScreenPageLimit parameter which was removed in v. 0.19.0. I want the same behaviour as Google Play store and only load the page when the user opens it. How can I set the offScreenLimit to 0 on my HorizontalPager?
c
That is already pretty much the default behaviour now, as Lazy* only does limited prefetching. Setting an off screen limit of 0 was never supported anyway, the minimum was 1 iirc (although it's been a while since I wrote that) /cc @Andrey Kulikov
a
So how is the Google Play App doing it? I have hughe performance issues with my Horizontal Pager, thats why I cannot load 3 pages at once. I want the app to only fetch the items form cache/remote server when he actually opens the tab
c
It's using Lazy. So its already performant. Have you tried a release build vs a debug build? Related thread: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1661246017260759 tl;dr: debug builds will always be somewhat slower. use release builds for true perf.
a
@Colton Idle Yes, i even enabled R8 and generated Baseline Profiles. It is faster but by far not as smooth as XML. Here my stackoverflow question regarding this topic where I docuemnted everything I tried so far. https://stackoverflow.com/questions/73573658/poor-performance-horizontalpager-jetpack-compose So the last two options that I have are: Going back to XML or prevent the HorizontalPager from loading 3 tabs a once like Google Play does it
c
I'd file a bug. The compose team has taken every perf "bug" pretty seriously. cc @romainguy?
270 Views