I have a weird issue where my sketch gets slower and slower the more Control P5 buttons I have. This behavior only shows up in Android mode, it seems fine when running in Java on OSX.
If you look at my code you will see I draw a UI with a bunch of buttons… If I comment out that code my sketch returns a value of 10 seconds which is correct for 24fps. If I leave all the buttons in my sketch the time goes up to 22 seconds… If I leave half the buttons in it is somewhere in the middle… I only create the buttons in setup so it seems odd that I am getting such a drastic slow down…
Cool sounds good. Also note that startup time with programs is especially hard to accurately measure, since so much is going on. It’s much better to measure the framerate or performance after the program is up and running.
That being said, it does seem suspicious that a few buttons would increase your startup time by 10 seconds!
I suggest you run examples provided by the library. Are they responsive?
I am not sure if printing to the console is helping here. Could you elaborate about your profiling? Are you synchronizing some event in the background or are you just testing the performance. If I were you, I would put an actual example together and test it. For instance, I ran your code without your printing and without altering the run cycle of cp5 and it is responsive.
I am using fullScreen(), I did not disable the autodraw and I am not calling stop within draw(). So yes, I am not calling cp5.draw() in draw with the above changes.
@kfrajer The slowness was not the responsiveness of the UI, the UI is snappy as expected.
The code listed is just sample code to illustrate the issue. My actual code loops through a folder of tiny PNG files and plays them as an animation. I did my animation at 24fps but noticed on playback it looked really slow.
That’s when I striped down my code to the minimum and still had the issue.
I’ll test the frame Rate tomorrow and report back…
I see now. Thxs for clarifying. Your best bet is to follow @Kevin’s advice then. Stick to java2d as it seems to be faster than P2D. Not sure why that is though… as I have seen cases of frame rate improvement switching to P2D.
@Kevin I thought it was the image sequence that was slowing things down but even with all that code stripped out cp5.draw() is slowing everything down…
I added the snippet you provided and it gave a very interesting result.
I switched to 48FPS and without cp5.draw() I get 48 FPS and with cp5.draw I get 23fps…