You may be able to improve the performance of the diamond case in Compose by building a single path that doesn't depend on x and y, and instead position it using a translation transform on the Canvas.
Repeating what I mentioned on Slack: my suggestion was not to apply a translation to the Path object itself. Instead create one instance of the Path, and before drawing, translate the Canvas: canvas.withTranslate { drawPath(…) } or equivalent.
Sorry for the mistake; I read your message too fast.
I tried your suggestion with one path and moving the canvas before drawing it. It’s still a little bit under the first implementation performances but more stable (no more freezing).
You may be able to improve the performance of the diamond case in Compose by building a single path that doesn't depend on x and y, and instead position it using a translation transform on the Canvas.
@romainguy Thanks for the proposal.
But applying a translation leads to another drop of FPS.
New implementation:
Results:
Repeating what I mentioned on Slack: my suggestion was not to apply a translation to the Path object itself. Instead create one instance of the Path, and before drawing, translate the Canvas: canvas.withTranslate { drawPath(…) } or equivalent.
Sorry for the mistake; I read your message too fast.
I tried your suggestion with one path and moving the canvas before drawing it. It’s still a little bit under the first implementation performances but more stable (no more freezing).