Tuesday, December 1, 2009

Pooled Display Object Initializer for Stardust



Stardust project homepage


One of the major CPU consumption cause of Stardust is the display object instantiation, since new display objects are created rather rapidly along the particle simulation. So I think using an object pool to store display objects that are no longer needed for future use is a nice way to improve performance.

The new PooledDisplayObjectClass and PooledDisplayObjectClass3D initializers are "pooled" versions of their counterparts, the DisplayObjectClass and DisplayObjectClass3D initializers, respectively.

I've run a quick performance test, and found that when using the PooledDisplayObjectClass initializer to initialize particles with display objects, the performance improves by approximately 10%~15%, compared to the original DisplayObjectClass initializer. It's not a significant improvement, but at least it's better :)

No comments: