FlashPools – performance test demo

So I started working on a new library which I am calling FlashPools. It is an ultra generic library to handle object pooling in Flex and Air.

You can register custom pool classes against the library to handle specific class types and what not. I’m trying to make it pretty flexible yet have an easy API to integrate with.

The ease of the API does conflict a bit though with trying to make the library run as efficiently as possible – there are certain niceties that can be achieved with things like describeType that clean up the API, but adversely effect performance. describeType in particular is painful as it uses e4x, which is expensive… especially if you are doing it ~100 times per frame.

i made a simple test app that does the following on every enter frame:

  1. attaches up to 100 instances to a canvas control (random amount)
  2. randomly selects new x,y positions for the attached instances
  3. removes up to all of the attached instances in the canvas control (random amount)

now here is a test of that process without using object pooling. notice the cumulative instantiation count and memory usage for the BlueCircle class:

random create/remove over 100 frames WITHOUT pooling

random create/remove over 100 frames WITHOUT pooling

now here is another screenshot taken after running the app again, but this time with object pooling enabled. again, notice the instaniation count and memory usages for the BlueCircle class:

random create/remove over 100 frames WITH object pooling

random create/remove over 100 frames WITH object pooling

the reason why the instantiation counts are important is because of the processing work involved with each instantiation. basically, the less instantiations you do, the faster the app will run.

the library is still pretty early yet, but I am pretty stoked about the results so far!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s