dimsuz
08/15/2022, 10:53 PMdrawable-xxxhdpi
, and I render it like so:
Box(modifier = Modifier.fillMaxWidth()) {
Image(
modifier = Modifier.matchParentSize().padding(19.dp),
painter = painterResource(id = R.drawable.impossibly_large_image),
)
Image(
painter = painterResource(R.drawable.regular_sized_image)
)
}
Both images have transparency.
I have some pointer input which changes parent composable's state, but this Box is isolated in a separate composable function, not depending on any state.
And I have GPU profiler on-screen spikes a quite above 16ms line (see thread for a screenshot).
If i remove that "oversized image" it immediately falls below 16ms.
My question is: shouldn't Compose pre-scale and somehow cache the Image? Are there some steps to encourage such caching?romainguy
08/16/2022, 12:30 AMRebecca Franks
08/16/2022, 7:32 AMdimsuz
08/16/2022, 10:11 AMThe performance impact is most likely due to sampling on the GPU hitting uncached data constantlyBy sampling do you mean me running this on-screen profiling? Laggy performance is there even with GPU profiling lines disabled. Or do you mean sampling GPU texture (I'm not that experienced in gpu internals...)
Have you tried loading it up using a library like Coil?I didn't yet, but thought about this. The problem goes away if I size image correctly, so not sure if I'll go that route, was curious to know why this happens.
romainguy
08/16/2022, 2:54 PM