Search code examples
flashactionscript-3adobe

as3: unpack zip = faster than loading single images?


by using external libraries you can also unpack a preloaded zip inside the swf.

but is that method faster than preloading one file ?


Solution

  • Yes. I've done some basic benchmarks, and implemented into a few projects, the answer is yes. Images are already compressed, so the performance gain has nothing to do with file size. Actually the zip might even be larger in the end. The gain is in the number of HTTP requests that need to be made. Every http request evolves a fair bit of hand shaking, reducing 50 requests to one shows a major speed difference, one that grows as the number of images increases.

    With text files, the difference is far greater, as you see compression too. One image by itself sees no benefit, only groups.

    Edit: I'll add the best solution seems to be storing bitmaps in a SWF and loading that. Flash does some amazing compression, especially with PNGs.

    EDIT 2: I've put up some simple tests as a demo here.