I have just disovered that adding `Modifier.graphi...
# compose-desktop
m
I have just disovered that adding `Modifier.graphicsLayer()`to an element that can be (de)selected improves performance a lot. Do I understand correctly that without using any
Modifier.graphicsLayer()
, every recomposition causes whole screen/everything to redraw, even when not everything is recomposed?
i
The current implementation of
graphicsLayer
on desktop just caches drawing operations, not the whole buffer with prerendered pixels. It can someway increase performance, but not significantly. In the future implementation can change, and layers can be cached fully (not only operations, but the whole rendered pixels). It will definitely increase performance (but also increase memory consumption). This will be investigated as part of this issue.
m
I have recently seen something called insets in Compose. Will that, or something else, eventually automatically track which regions need to be repainted? I assume much gradualness can be achieved even without cached bitmaps (at least when there are not many overlaps and transparency). Secondly, right now, is only a window (re)painted, or a whole content?
i
insets in Compose.
I am not sure which insets you mentioned, by usually insets has nothing to do with redrawing optimisation.
I assume much gradualness can be achieved even without cached bitmaps (at least when there are not many overlaps and transparency).
Yes, it is one of the options - not to cache into bitmap, but only redraw a part of the screen. For this optimisation, even explicit
graphicsLayer
probably won’t be needed (I just checked, and Compose creates a separate layer per
Box
).
is only a window (re)painted, or a whole content?
If we have multiple windows, only the changed window will be repainted.
m
Thank you. As per window I ask about a situation when content exceeds the window size. E.g. if I have a list of a few hundred elements, I feel like all of them are (re)painted, not only those currently visible.
i
E.g. if I have a list of a few hundred elements, I feel like all of them are (re)painted, not only those currently visible.
Only visible content repainted