Based on Compose Compiler Metrics, it seems `Paint...
# compose
a
Based on Compose Compiler Metrics, it seems
Painter
and
Icon
are unstable and keeping the function as non-skippable. Any ideas how else I could optimize my Coil Image Grid? Or does coil already able to optimize this somehow. It’s quite slow
b
Can you please share the Composable signature? Are you passing a painter and icon to each item in a grid?
a
It looks like this
Copy code
restartable scheme("[androidx.compose.ui.UiComposable]") fun Thumbnail(
  unstable painter: Painter
  stable contentDescription: String?
  stable modifier: Modifier? = @static Companion
)
It’s for each
item.thumbnailUrl
-> Thumbnail(
rememberImagePainter(Any)
)
b
Are you using Coil 1.x? I think they made big performance changes in 2.x. Might be worth testing the upgrade
Also, is there a reason the painter is hoisted and you aren't just passing in the url which would be stable?
a
Yes, Coil 1.0.
Thumbnail
is just a wrapper to
Image
and we use
rememberImagePainter
. That’s a good point though, we pass either
Painter
or
Any
, but I’ll try passing stable params
String
as much as possible. I tried Coil 2.0 before as a draft and there were actually performance improvements (though the huge janks were still there in my previous thread)