Posts Tagged bitmapdata

PNG, JPEG, and JPEG-XR Compression and Decompression Performance

Tags: , , , , ,

Are you using the fastest assets you can? Yes, even the file format of the assets you use has a big bearing on the performance of your app. Ask yourself: is PNG faster to decompress than JPEG? Is it faster to compress to JPEG-XR or PNG? Do the quality settings matter? Today’s article explores the performance of Flash’s main three image formats—PNG, JPEG, and JPEG-XR—to find out which decompresses fastest at load time and compresses fastest at save time.

Read the rest of this article »

7 Comments

How To Reclaim Hidden Unused Bitmap Memory

Tags: , , ,

As I discovered in the previous articles, loaded bitmaps are stored in memory in two forms: the compressed PNG, JPEG, JPEG-XR, GIF file and the uncompressed RGBA pixels. If you don’t use the pixels, Flash Player will reclaim its memory and then uncompress it if you use the bitmap later on. However, if you do plan to use the bitmap, isn’t the compressed file data just memory overhead? Today’s article will show you how to dump this unused file data and save a bunch of memory.

Read the rest of this article »

3 Comments

Keeping Bitmaps Decompressed

Tags: , , ,

It came to my attention in the comments of Preloading Bitmap Decompression that Flash Player would actually free the decompressed bitmap memory if you didn’t make active use of it, similar to garbage collection. So if you followed my strategy from that article to preload a bitmap, it may have been un-preloaded for you by Flash Player! Today’s article shows you how to work around this little problem.

Read the rest of this article »

22 Comments

Preloading Bitmap Decompression

Tags: , , ,

Since they were introduced way back in Flash Player 8, bitmaps have become a core feature in almost all Flash apps. The way you handle them—creation, operations, and destroying—is one of the most important factors determining your app’s performance. Today’s article shows one little-known trick to help out the performance of loading and using bitmaps.

Read the rest of this article »

10 Comments

Compressed Stage3D Textures With ATF

Tags: , , , ,

Adobe has recently released tools to allow us to use compressed textures with the Stage3D API via their ATF tools. What are these compressed textures? Why would we want to use them? How do they work? Today’s article is an overview of compressed textures covering these questions and more.

Read the rest of this article »

10 Comments

Loop Speed Redux

Tags: , , , , , , , , , ,

AS3 has three kinds of loops—for, for-in, and for-each—but which is fastest? I attempted to answer that question about three years ago, but the article is in dire need of a followup as many version of Flash Player have been released since then and the question is core to our everyday lives as AS3 programmers. So which type of loop is fastest in 2012?

Read the rest of this article »

15 Comments

Stage3D Readback Performance

Tags: , , , , , ,

At long last, Flash Player 11 has been released and carries with it a raft of exciting new features. Perhaps most exciting is the inclusion of the new Stage3D class (and related libraries) to enable GPU-accelerated graphics rendering. Today’s article will be the first to cover this new API and discusses one of its features: reading back the rendered scene into a BitmapData that you can put on the regular Stage. Surely this will be a popular operation for merging 3D and 2D, so let’s see how fast it is!

Read the rest of this article »

13 Comments

Composing BitmapData Scenes

Tags: , ,

Since Flash 8, BitmapData has offered a wide range of possibilities to improve performance. Many Flash apps, particularly games, choose to simply display a single, huge BitmapData, render the entire game scene into it and, for the most part, eschew Stage‘s whole system of DisplayObject and DisplayObjectContainer. When you’re doing this or just generally using BitmapData for more than just raster (e.g. JPEG, PNG) image display, you should know your options for composing a BitmapData out of other BitmapData. Today’s article discussing the performance of the two main ways of composing these BitmapData scenes: BitmapData.draw and BitmapData.copyPixels.

Read the rest of this article »

13 Comments

The Size of Empty

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , ,

I was reminded about the flash.sampler API by Grant Skinner’s recent post about it. While only available in the debug player, it can still tell us some valuable information about what goes on in the release player. Today I’m using the getSize function to find out how much memory overhead various classes impose, even when they are empty.

Read the rest of this article »

15 Comments

BitmapData Alpha Performance

Tags: , , ,

The BitmapData class is among the most useful classes in AS3. When it was introduced in Flash 8 it dramatically improved Flash development by opening up new potential for features and optimization. Since it’s used so often, it’s good to know as much about it as possible. Today I’m going to cover the performance difference that turning alpha (a.k.a. transparency) on makes.

Read the rest of this article »

4 Comments