drawcall / Proton

Javascript particle animation library
https://drawcall.github.io/Proton/
MIT License
2.42k stars 275 forks source link

Upgrade pixi.js to 5.0.2 and improve PixiRender and Emitter performance #60

Closed Alchemist0823 closed 4 years ago

Alchemist0823 commented 5 years ago

The default pool in PixiRender actually makes rendering slower. Because it iterates through the object map to find the available body. The fast pool only collects dead particle body and the new particle will use the dead bodies. We keep the dead body in Container to avoid expense removeChid and addChid calls.

Also I improve Emitter performance by swaping the deleted element with last one and pop the last one instead of splicing. splice function removes an element in a middle of js array. It is very expensive.

drawcall commented 5 years ago

Very good idea, but I need to verify it because there are a lot of changes