-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance issue when shutting down scene on Phaser 3.60.0 #6482
Comments
I can't debug screenshots I'm afraid. While it's clear that your game is taking a while to destroy this Scene, it's not a global change that impacts every game in 3.60, so it's going to need a lot more debugging to narrow down - ideally the game itself, so a test case can be created. |
Thank you for your prompt reply! Thanks |
Hello! I use particle emitters on the enemy sprites. These sprites are pooled in a GameObjects group. When the sprite was hit I would deactivate it and return it to the group. But when the sprite was spawned again pulling it from the group then I was re-creating the particle emitter. However, it still takes about twice the time compared to 3.55.2 which would take under 500ms. Using again the Chrome profiler I saw that it takes some milliseconds (around 20) in the |
Looks like |
Yeah, we can skip installing the |
Thank you very much. |
@kpagan I made a quick test and found destroying 10k particles took 500ms — but that's quite a lot of particles. So you might also check to see that you're not creating more particles than you intend to somehow. |
Thanks @samme!
|
|
That could be 7 * 1000 = 7000 particles at least. |
Wow thanks @ddanushkin ! I had this code taken from the labs examples and never thought what this @samme please note that this reserve is not in the particle emitter that would have 7 instances but still this FireSmokeComponent class has 3 particle emitters each one reserving 1000 particles and I had it created 2 times so in total 2 * 3 * 1000 = 6000 particles that were actually useless because they would not add a visual effect. It makes me wonder how it worked in Phaser 3.55.2 though. I guess the particle emitters were never destroyed but they would remain in memory and never garbage collected thus causing a memory leak. Thank you all guys for all the help!!! |
You can check these with
|
Since not much have been posted on this issue and I have resolved the problem this issue can be closed. |
Version
Description
Hello,
I was developing a space shooter game with Phaser 3.55.2 and after the 3.60.0 release I started migrating to the new version.
After the code migration I tested the game and found out that when I complete a level and click the OK button to return to the main menu scene it takes almost 10 seconds to transition to the scene.
I run a performance analysis with the Chrome profile and it seems that the removeListener, destroy and preDestroy methods to take too long. In 3.55.2 this would take just milliseconds. You can check the screenshot of the Chrome profiler.
When the scenes are shutting down I remove all listeners. However, I tried to comment out the code that cleans up but it still takes around 10 seconds.
Example Test Code
Additional Information
The text was updated successfully, but these errors were encountered: