# FPS drop over time ( fixed )

**URL:** <https://discourse.processing.org/t/fps-drop-over-time-fixed/18982>\
**Category:** Coding Questions\
**Created:** [March 24, 2020, 2:28pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982 "2020-03-24T14:28:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ManuManu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/manumanu/32/8522_2.png) [@ManuManu](https://discourse.processing.org/u/ManuManu)\
**Post date:** [March 24, 2020, 2:28pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982/1 "2020-03-24T14:28:56Z")

</div>

Hey,  
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:  
[https://editor.p5js.org/manumanutattoo/sketches/EtW8jdywd](https://editor.p5js.org/manumanutattoo/sketches/EtW8jdywd)

PS: im on windows10 with Chrome

---

<div class="post-metadata">

**Author:** ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)\
**Post date:** [March 24, 2020, 3:39pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982/2 "2020-03-24T15:39:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ManuManu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/manumanu/32/8522_2.png) [@ManuManu](https://discourse.processing.org/u/ManuManu)\
**Post date:** [March 24, 2020, 3:50pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982/3 "2020-03-24T15:50:57Z")

</div>

awesome, this was the problem.

thank you very much !

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 24, 2020, 3:52pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982/4 "2020-03-24T15:52:12Z")

</div>

Hello,

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.

`:)`

---

<div class="post-metadata">

**Author:** ![ManuManu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/manumanu/32/8522_2.png) [@ManuManu](https://discourse.processing.org/u/ManuManu)\
**Post date:** [March 24, 2020, 3:58pm UTC](https://discourse.processing.org/t/fps-drop-over-time-fixed/18982/5 "2020-03-24T15:58:04Z")

</div>

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