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
cb
09/08/2022, 12:14 PM
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
Aaron Waller
09/08/2022, 12:40 PM
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
Colton Idle
09/08/2022, 1:47 PM
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
Aaron Waller
09/08/2022, 2:17 PM
@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
Colton Idle
09/08/2022, 5:56 PM
I'd file a bug. The compose team has taken every perf "bug" pretty seriously. cc @romainguy?