Skip to content
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: [v8 regression] Container.destroy() is very slow on crowded containers #10345

Open
joergplewe opened this issue Mar 19, 2024 · 6 comments · May be fixed by #10505
Open

Performance: [v8 regression] Container.destroy() is very slow on crowded containers #10345

joergplewe opened this issue Mar 19, 2024 · 6 comments · May be fixed by #10505
Assignees

Comments

@joergplewe
Copy link

joergplewe commented Mar 19, 2024

Current Behavior

Admired developers,

I frequently have to clear crowded containers (>100000 children) and observed that Container.destroy(true) can take several seconds.
Compared to my v7 code, where destroy() wasn't noticable at all (using ParticleContainer, to be fair).

Clearing the container 'by hand' before calling destroy() speeds up the process significantly, which makes me think it might be a bug.

myContainer.removeChildren().forEach(child => child.destroy(true));

Expected Behavior

destroy() shouldn't be slower than clearing a Container by hand.

As fast as ParticleContainer would be great :).

Steps to Reproduce

Use playground https://www.pixiplayground.com/#/edit/zFuIcJIth6M6QmC2IAjR9

After 200 frames, the content will be destroyed and starting to reconstruct.
largeContainer.destroy(true); may halt rendering for a couple of seconds.

Setting MAKE_IT_FAST_AGAIN=true clears largeContainer manually before destruction, bringing up speed again,

Environment

Possible Solution

There is a workaround by clearing the container upfront destroy():

myContainer.removeChildren().forEach(child => child.destroy(true));

Additional Information

No response

@joergplewe joergplewe changed the title Bug: [v8 regression] Container.destroy() is very slow on crowed containers Bug: [v8 regression] Container.destroy() is very slow on crowded containers Mar 19, 2024
@GoodBoyDigital
Copy link
Member

heya @joergplewe ! can i ask, how does this compare to a regular Pixi v7 Container? thanks!

@joergplewe
Copy link
Author

Hi @GoodBoyDigital !

I prepared a comparable playground for v7: https://www.pixiplayground.com/#/edit/YVV1kTr_pTz9VZKNOQFpv

v7 destroy() does not even take a blink.
The v8 sample is much slower even with the workaround MAKE_IT_FAST_AGAIN=true.

@joergplewe
Copy link
Author

is this comparable to #10377 ?

@albertreed
Copy link

I'm new to Pixi, but at least for my application calling application.destroy() sits and spins until the tab crashes. Tried the OP's suggestion (on stage), but that also hangs.

@joergplewe
Copy link
Author

updated playground to 8.1.0

@GoodBoyDigital GoodBoyDigital changed the title Bug: [v8 regression] Container.destroy() is very slow on crowded containers {erformance: [v8 regression] Container.destroy() is very slow on crowded containers Apr 29, 2024
@GoodBoyDigital GoodBoyDigital changed the title {erformance: [v8 regression] Container.destroy() is very slow on crowded containers Performance: [v8 regression] Container.destroy() is very slow on crowded containers Apr 29, 2024
@GoodBoyDigital GoodBoyDigital linked a pull request May 2, 2024 that will close this issue
4 tasks
@GoodBoyDigital
Copy link
Member

much faster now :D #10505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants