Anthony Mamode
06/13/2025, 4:10 PMImage
from Compose directly, why is that?
• Using a loading library like Coil or Sketch
◦ I got really good results on Android native
◦ On CMP I got bad results on iOS (not surprising) BUT I got pretty bad results also on Android (drop frame)...
I assumed CMP code on Android would behave similarly to native since it’s Compose under the hood. Could this be due to the image loading libraries (Coil/Sketch) behaving differently in CMP? Any idea on how improving these results on CMP/android?Anthony Mamode
06/13/2025, 4:11 PMAnthony Mamode
06/13/2025, 4:12 PMshikasd
06/13/2025, 4:26 PMon cmp/android it is far from android native resultsWhat is the native implementation you are comparing it to?
shikasd
06/13/2025, 4:27 PMMichael Paus
06/13/2025, 6:30 PMshikasd
06/13/2025, 6:30 PMTomislav Mladenov
06/13/2025, 10:22 PMKaanixir
06/14/2025, 1:07 PMkey(..)
so you are enforcing lazy diffing on off-screen rows while you enforce 9000
matrix operations all at once in the craziest way possible, what are you doing - this isn't benchmark, you're butchering compose not even using any APIs in the way they should be, then rushing to blame compose for it 👌
you are spinning up a rememberInfiniteTransition
recreating it 300 times while you .rotate(angle)
on 30 children inside each row, triggering 9000 matrix updates and rerasterizations every 16 ms without even a key() to setup diff on list items
items(300) in the outer LazyColumn × items(30) in every inner LazyRow
→ 300 rows × 30 cells = 9 000 composables that hold a graphicsLayer rotation each frame.
you're also enforcing decoding of each image on compose while in your flutter it aggressively caches by default, you should have used painterResource
etc.. with key parameters.
edit: finally though, these are not the worst, worst offenders. The worst thing in your code was val infiniteTransition = rememberInfiniteTransition()
executing 300 compositional scopes for each row, which should have been a single global transition at the top level
if people used compose properly they would notice that it's better in every wayAnthony Mamode
06/14/2025, 2:52 PMhugo
06/15/2025, 2:57 PMAnthony Mamode
06/16/2025, 7:12 AMJonathan
06/16/2025, 2:23 PMAnthony Mamode
06/16/2025, 3:06 PMTomislav Mladenov
06/16/2025, 3:19 PMshikasd
06/16/2025, 3:20 PMPHondogo
06/16/2025, 3:26 PMAnthony Mamode
06/16/2025, 3:29 PMeygraber
06/16/2025, 4:06 PMAnthony Mamode
06/16/2025, 5:04 PM