https://kotlinlang.org logo
Title
f

Filip Wiesner

04/28/2023, 2:38 PM
So, because of performance issues I've tried profiling my app and
Compose:applyChanges
takes over 500ms - what do I do? 😄 I have a fairly complicated layout with a lot of Crossfades and stuff changing. What are the things I should be primarily looking for? Stability of parameters, recomposition counts, heavy calculation inside composables (filtering, mapping lists) and things like that? I am not looking for any specifics, just generally some steps which would you go through when encountering this sort of problem.
s

shikasd

04/28/2023, 3:50 PM
applyChanges usually refers to heavy calculations in effects / remember observers it is hard to predict exactly, but try to look for
DisposableEffect
or similar blocks that are doing too much work
It can also refer to movement of
LayoutNode
inside movable content, if crossfade uses it. If that's the case, consider wrapping the content with
BoxWithConstraints
, which contains subcomposition. It is a bit hacky way of fixing it, but can generally help 🙂
f

Filip Wiesner

04/28/2023, 3:57 PM
Thanks a lot for the tips. I really appreciate it