actionscript-3apache-flex

Why does the Flex compiler generate varying file sizes on successive compilations of the exact same source code?


I'm building a SWF using the command line compiler mxmlc.exe. The compiler writes the output file size as part of it's stdout. If I run the compiler multiple times in succession without changing the actual source code, I see the file size bounce up and down a few bytes at a time.

C:\>mxmlc.exe Gallery.as
C:\Gallery.swf (28443 bytes)

C:\>mxmlc.exe Gallery.as
C:\Gallery.swf (28442 bytes)

C:\>mxmlc.exe Gallery.as
C:\Gallery.swf (28440 bytes)

C:\>mxmlc.exe Gallery.as
C:\Gallery.swf (28442 bytes)

I can't think why this would possibly be the case. Even if I delete the output file each time, the re-generated file size still varies in this way.

Any ideas why?


Solution

  • The Flex compiler includes some information in your SWF that changes from build-to-build, such as the date and time it was built. The SWF is then compressed. Sometimes the compression will work a bit better than others for the varying metadata, thus the minor changes in file size.

    http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_16.html#145380