Ive been trying to wrap my head around some linger...
# compose
z
Ive been trying to wrap my head around some lingering performance issues Ive been seeing since adopting compose. It seems to happen whenever the state is updated and recompositions happen in a deeeeep hierarchy of composables. Are there any ways I can optimize it such that only parts of the composables are invoked? Ive followed best practices all throughout, but my state is complex, and the composables rendering it are complex as well, yet as simple as Ive been able to make them! More details in thread 🙏🏽🧵
My composable hierarchy; - Scaffold (this is where
stateFlow.collectAsState()
is called) - TopBar with several timers - Pager where each page consists of a LazyColumn - BottomBar with its own set of input fields, buttons, and a LazyRow The actual UI • Ive read about donut hole skipping many a times. • Ive also experimented with marking the state (and "subsets" of it)
@Stable
and
@Immutable
. Both have helped me become a better composer, and the flow is a bit smoother - but still laggy for certain devices (especially lower-end). Im sort of confined to having a state at the root of the composable hierarchy. I take it that multiple
stateFlow.collectAsState()
throughout the hierarchy of composables would help otherwise.
a
Can you share your code for this screen?
z
@Adam Powell Yes, Ill send you a link to a gist (its a lot of code)