I’m working on a patch where I’m looping through 32 instances of a small class, and each one draws a few Skia primitives. Every instance outputs a Skia layer made up of some simple circles—some with shaders and filters, and everything gets masked once. Each instance also has its own unique behavior using random functions and dampers.
Performance is great at first, but after a while the frame rate starts to dip, and the “Render” value in the Perfmeter shoots up. Kinda strange—it runs smoothly in the beginning, but gradually gets worse. Not sure if my laptop is just struggling, or if there’s something in the patch that’s slowly dragging things down.
Here’s the function that generates the output layer for each instance:
I made a simplified version of the Skia part of the patch, and it’s definitely running a bit smoother than the original/ bigger version. But I’m still noticing that the longer I move the mouse in the render window, the worse the performance gets over time.
Not sure if there’s too much caching going on or if that’s just expected behavior… but it feels like it should be running a bit smoother than it is.
Any tips on how I could improve performance would be super appreciated :)
Actually, @schlonzo reported the same problem in this post:
Turns out, removing the SetMaskFilter + Blur from the class makes everything run nice and smooth again ;) looks like using MaskFilters inside a ForEach causes some kind of memory leak.