navigating back and forth between two composable f...
# compose
m
navigating back and forth between two composable fragments sometimes cause a ‘lag’ navigating back and i narrowed it down to this composable:
Copy code
Image(
    modifier = Modifier
        .fillMaxSize(),
    painter = painterResource(id = state.itemList[page].imageRes),
    contentDescription = null,
    contentScale = ContentScale.Crop
)
This is loading a webp image. Maybe it is related to the image size. But most of the times it has no lag. What could it be ?
z
Does it only lag the first time a given resource is shown?
m
no. it is random. i would say 1 time out of 5. I’m investigating the issue with @Stable wrapper list
nah. its the same =(
i can send you a video by pm if you want. Can’t post here
z
have you attached the profiler?
m
I’ll when i get the time
a
if you suspect it might be related to the image size then it probably is. ui.perfetto.dev is the best way to see where time is going; the usual stuff around only measure performance on a release build applies here too. Very large images can take significant amounts of time to upload to the gpu, and if you have a large image resource that isn't in a
drawable-nodpi
resource folder the system may be upscaling it and making the problem even worse
m
ya, maybe. But it behaves normally with non-compose view
i’ll check. thanks