25 June, 2010

[Cool Tool] Assembly minifier tool

[Cool Tool] Assembly minifier tool: "
If you are using Silverlight controls from the Telerik suite, you’re going to love this.
Telerik provide a new free tool to help reduce the size of your Silverlight xap. The Telerik Assembly Minifier can be found here:
http://minifier.telerik.com/
From the website: “Telerik Assembly Minifier is a tool that lets you extract only the controls’ classes and resources you need to use in your application development, thus significantly reducing the size of the assemblies. Using the Assembly Minifier you will achieve significantly better loading time when the Silverlight XAP files containing the minified (optimized) assemblies are to be loaded on the client side.”
Note: this apply to Telerik assemblies only (for now).

I decided to give it a try and create a fresh new Silverlight 4 app then insert a Telerik GridView in a page. VS automatically adds reference to these assemblies:
  • Telerik.Windows.Data.dll
  • Telerik.Windows.Controls.Input.dll
  • Telerik.Windows.Controls.GridView.dll
  • Telerik.Windows.Controls.dll

That’s 645KB (compressed) added in your xap file, ouch!

Now let’s add a CoverFlow and a Scheduler controls in my app. This adds 2 more assemblies in the resulting xap:
  • Telerik.Windows.Controls.Scheduler.dll
  • Telerik.Windows.Controls.Navigation.dll

That’s an additional 413KB in the xap.

At that point my xap file is 1.2MB, and my app is quite empty, most of the size is coming from the Telerik assemblies. Great features comes with a price, right ?

Now let’s try the Assembly Minifier tool.
Go to http://minifier.telerik.com/ and upload the Telerik assemblies used in your app.

Then I select the controls to be extracted (GridView, CoverFlow and Scheduler here):

Now I can click on the “Extract” button to download the compressed assemblies and reference them in my app (I removed the originals first).
After recompiling my xap is now 845KB, that’s 32% off.
So finally for my very specific test (empty Silverlight 4 app with 3 Telerik controls: GridView, CoverFlow and Scheduler) I get this result:
xap file size
Before
After
1.2MB
845KB
[32% gain]
Overall this is good, as always Telerik innovate in new tools and it’s nice to see them answering concern like xap files size. But to me the whole process to manually choose your controls and manually upload and manually replace dll is totally inefficient for now. The tool is still beta (and free!) so I do not complain, I just hope to see more features and a better integration in VS later. In a perfect world a VS add-in would do the job automatically when I build in release mode.
Note the tool is working properly, but the way to replace your dll in VS is not (always grab the old replaced dll). You can find some tips to fix it but it is definitely painful for now. Hope VS will provide an easier way to handle this in the future, or maybe Telerik to create a VS addin or something...
Waiting for that you’ll find great help here:
http://www.telerik.com/community/forums/silverlight/assembly-minifier.aspx
"

No comments:

Post a Comment

Suggestions are invited from readers