FPS drop over time ( fixed )

Im new on P5.js, and just started a simple project.
i just start a simple code, but i allready have fps drops over time.
When a run the code, it start at 60 FPS, but it drop over time to 20 FPS after 5 mins and keep falling…
I dont really understand what is wrong in my code…
do you guys have an idea ?
( sorry if this a noob question )
Here the sketch:

PS: im on windows10 with Chrome

1 Like

You use push() quite a lot. Reference says:

The push() function saves the current drawing style settings and transformations, while pop() restores these settings. Note that these functions are always used together.

Each push consumes memory while pop releases it. I assume that’s slowing down your code. You can use resetMatrix() in some cases and just reset fill() and stroke() values as you have done.


awesome, this was the problem.

thank you very much !


I removed the push(); did not see a pop() and there should be one.

I reduced entities to 1200 and get a steady 60 fps.



yeah, i didnt know about the push() and pop() … i’m such a newbie lol
thank very much for the help.