to calculate list changes, it’s recommended to run the diff calculation on a background thread since it can be slow. This makes it tricky to use with declarative programming, because state updates to the list don’t synchronously get propagated down the tree (e.g.
in an item view causes a new list to be emitted with new text, but that text doesn’t get bound to the actual view until a few main loop iterations later, which causes state to get out of sync when typing fast). What implications does this have for
in Compose?Add/remove item animations can be done at the per-item level, which seems straightforward enough. But if the list is re-ordered, or items are inserted anywhere other than the end of the list, does
preserve composable state/groups by keying on the list items (i.e. using key/Pivotal machinery)? If it does, does it process those changes more efficiently than
? Does this question not even make sense in the Compose world?
but it still means that you’re going to be iterating over the full list etc.
adapterlist (or other virtualized primitives) should get you into a camp where you’re not doing an O(n) recomposition even if its shallow, and instead just doing O(screen size)
but that still means if you have no extra information that you have to run a diff of the data somewhere
ideally we give you an API to provide additional information (e.g., “5 new items inserted at X”) but we are still figuring out the best way to handle this type of thing and sort of get out of your way a bit