https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

mohamed rejeb

03/14/2023, 3:17 PM
Hi everyone, I'm working on a big desktop project using compose, and it's a pdf editor where you can see the content of a pdf file and draw stuffs on it, I'm using compose canvas but when the user is drawing the project uses a big percentage of the CPU and the app is laggy in some devices, any ideas ? (idk if I could use skia I thought that it's used by default, also for hardware acceleration is it enabled by default ?)
a

Alexander Maryanovsky

03/14/2023, 3:20 PM
A sample we could run would help.
l

Landry Norris

03/14/2023, 3:23 PM
I’d guess that the pdf content is on the same layer as the drawings above, or is missing a remember. It’s probably drawing too much at once, when most of it should be cached.
k

Kirill Grouchnikov

03/14/2023, 3:29 PM
How is the performance when you don’t display the PDF content, and only show the canvas with the user drawing?
m

mohamed rejeb

03/14/2023, 3:29 PM
@Landry Norris true, is there something similar to android layout inspector to debug recomposition.
@Kirill Grouchnikov I tried to remove the pdf and also remove the drawings so I'm just listening to the gesture and updating the state and the performance is the same, I have a single big state for the hole project and I'm using MVIKotlin, so when I draw each drag movement is going to update the state again
@Alexander Maryanovsky I will create a sample ASAP
a

Alexander Maryanovsky

03/14/2023, 3:33 PM
Thanks
k

Kirill Grouchnikov

03/14/2023, 4:46 PM
Remove as much as you can so that it's easier to reproduce and debug. Sounds like you need to take a look at how you're tracking the user interaction, even before the drawing itself
3 Views