natario1
10/25/2021, 7:57 PMSubcomposeLayoutState.maxSlotsToRetainForReuse
is supposed to do? I have a LazyList-like component where only some children are subcomposed and I'm playing with this value, but I fail to see any effect. What's the metric I should be looking at?Andrey Kulikov
10/26/2021, 12:21 PMnatario1
10/26/2021, 12:41 PMmaxSlotsToRetainForReuse
has no effect when scrolling. Whenever a new item enters the visible viewport, another disappears at the other end, and subcomposer will always reuse the disappearing composition for the new one. Right? Assuming its >= 1.
The thing I was trying to achieve is quite the opposite - I want to ensure that at least a certain number of composables are cached. If I see 0-1-2 and scroll to 1-2-3, I'd like 3 to be a fresh composition and 0 be cached, so that when I go back to 0-1-2, 0 it is rebound to the same key. This would be much more efficient at least for my use case.
Is there any way to achieve this? In some way, I think I'm looking for a *min*SlotsToRetainForReuse.Andrey Kulikov
10/26/2021, 1:18 PMmaxSlotsToRetainForReuse
is at least 1 then after the whole pass instead of disposing unused 0 we retain it in a cache. and then when on a next measuring you will compose 2 and 3 we will reuse the cached composition for 0 for composing new item 3Andrey Kulikov
10/26/2021, 1:19 PMnatario1
10/26/2021, 1:29 PMremember(key) { ... }
. which can be way heavier. Please let me know if there's a ticket I can follow for this! Thanks 👍Andrey Kulikov
10/26/2021, 1:34 PMnatario1
10/26/2021, 1:46 PM