hrbrmstr / pewpew

:star: :star: :star: Build your own IP Attack Maps with SOUND!
https://rud.is/pewpew/
1.02k stars 232 forks source link

Added an `if` statement checking the state of `document.hidden` befor… #36

Closed alyxw closed 2 years ago

alyxw commented 2 years ago

Resolves #35 Added an if statement checking the state of document.hidden before attempting to draw. If it attempts to draw, it will still play the sound if it can to sound like it's still doing something and will immediately begin drawing again when the page is tabbed back to.

Following the patch, over a five minute period tabbed away the memory usage hovers around 6-8MB

alyxw commented 2 years ago

Running a proper profile right now to get some pretty graphs.

alyxw commented 2 years ago

"before"

image
alyxw commented 2 years ago

Following the change, the JS heap is only at 5.9MB after 120 seconds as opposed to 22.1MB before the change.

image