Sunday, December 19, 2010

When Does It Make Sense To Use Bitmap Caching?

The basic rule of bitmap caching is to apply it on the objects which do not involve frequent changes in the pixels layout. To explain in a simple language, there should be less scaling and rotation, but any animation or movement is allowed. But why is it required? Let us first understand what bitmap caching is.

Bitmap caching helps in enhancing the performance of any movie clip, which doesn't involve any change in the pixels. Setting the property "cacheAsBitmap" as true, the internal representation of the movie/button is cached by the flash player. So any movement, or animation applied to it, re-uses the cache. 

But any scaling or rotation applied to the movie/button, redraws the complete pixels layout of the original object, hence in this case we are not re-using the cache. So the primary purpose of bitmap caching is not fulfilled here.

Also note that, if there are no movements applied to the object, bitmap caching only uses more memory than which is required and serves nothing good to the performance of the application.

So here are a few points to remember, as to when to apply and when not to apply bitmap caching to any object:

1. Do apply bitmap caching in case of complex images.
2. Do apply bitmap caching where scrolling is involved in the movie clip. When scrolling happens, the new items in the scroll are displayed over the existing pixels layout of the object.
3. Do apply bitmap caching in case where there are multiple windows popping up in any application. If the two popped-up windows occupy the same surface area, the common pixels layout doesn't get regenerated.
4. Do not apply bitmap caching on zoomed surfaces, as it takes a lot of memory and overuse of caching makes the performance very poor.
5. Do not apply bitmap caching if you are not applying any movement to the object, else caching will take unnecessary memory space.
6. Do not apply bitmap caching to more number of objects in one application, as it again takes lot of memory space. Make an optimized usage of bitmap caching.

No comments:

Post a Comment