Accessibility

Table of Contents

Using Runtime Shared Libraries

Download Performance

Although Flash Player expects an RSL to be a SWF file, the file generated from a SWS library specification is actually a SWC component library. A SWC file is a compressed archive (in ZIP format) containing an implementation SWF file and additional metadata for use by the compiler. (This enables you to quickly switch between dynamic linking with the rsl property and static linking with the lib property!)

The library you built from shared.sws is created in the Flex server's generated/libs directory hierarchy. The Flex server knows how to extract the implementation SWF file (often named Library.swf) from the SWC file by the URL; in this case the URL is shared.swc.swf. You can use any ZIP tool to peek at the size of the SWF inside the library:

% unzip -l $FLEX_APP/WEB-INF/Flex/generated/libs/*/shared.swc | grep '.swf'
   140628  10-18-04 07:23   Library.swf

Notice that the aggregate size of the dynamically linked application app2.swf plus the RSL shared.swc.swf is larger than the size of the statically linked app1.swf file. This is due to the overhead that is part of a SWF library as well as some lost opportunities for code merging in the optimization phase of the Flex compiler.

This overhead should make it obvious that RSLs do not help if you only have a single Flex application. The real download performance benefit occurs when you have multiple applications sharing the same RSL.

Imagine users downloading two statically-linked applications similar to app1.mxml compared to downloading two dynamically-linked applications similar to app2.mxml:

2x (app1.swf @ 129899 ) = 259798

2x (app2.swf @ 9127) + (shared.swc.swf @ 140628 ) = 158882

The aggregate download size improvement using dynamic linking is clearly a big win here (That's about 18 seconds for a user on a 56K modem, if those still exist; but perhaps more importantly it reflects nontrivial cash savings in network usage if you have lots of users.). The download size improvement only improves more so as you leverage the same RSL! Thus, although the download size of a single dynamically-linked application is slightly worse than the download size of a comparable statically-linked application, the amortized download performance across multiple applications is much better.