https://kotlinlang.org logo
Title
a

allan.conda

07/07/2022, 6:28 AM
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

Ben Trengrove [G]

07/07/2022, 7:38 AM
Can you please share the Composable signature? Are you passing a painter and icon to each item in a grid?
a

allan.conda

07/07/2022, 9:43 AM
It looks like this
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

Ben Trengrove [G]

07/07/2022, 9:46 PM
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

allan.conda

07/08/2022, 7:32 AM
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)