There are several ways in which we can optimize the size of an application and to ideally increase the performance but using RSL does make a substantial change in the size of the SWF file. It makes the shared assets into a standalone file that can be downloaded and cached seperately on the client side.There are different types of RSL that are supported in Flex.
Why do we use RSLs ?
We can check this by creating a new flex project in flex builder, we will have an approx of 250KB of SWF file size and when we have RSL enabled the SWF file size is reduced considerably to 99KB which gives a clear indication on scale to which a flex application can be optimized.
How you can do it?
In Adobe Flex 3 the RSL is not enabled by default and everytime you compile your application everything including the framework gets compiled into the SWF file that comes as the output of your app.
Now enable RSLs from the Library Path in the properties of your project.
Now we can go into the details what all happens.
Since we are considering this simple flex application we will only go through Framework RSLs in this post.After the above settings you build your application and you will find the bin folder has 2 more extra files generated from compilation – framework_220.127.116.1152.swf and framework_18.104.22.16852.swz
These are framework RSLs which is externalized from your main application SWF and this results in considerable weight loss of the main SWF file. The framework RSLs consists of the pre-compiled libraries of Flex components and class libraries. These RSLs comes in two version – Signed (framework_22.214.171.12452.swz) and Unsigned (framework_126.96.36.19952.swf) Framework RSLs. Signed RSLs are cached in player cache whereas the unsigned ones are cached in the browser. Similarly along with flex framework the rpc and datavisualiztion components are also included in the Framework RSLs.
Since this is huge topic to be completed in one single post, I will again elaborate on this segment in my coming posts. So stay tuned… 🙂