If your Silverlight XAP size is large (>1 MB), better be thinking about reducing the size to improve performance and ultimately, the user experience. Here are few tried and tested ways to do it.
1) Split the XAP into two or more till an optimal size is reached. For an app that has login followed by viewing the actual app, you could split the login and user profile into two xaps. This way the login process seems pretty fast. Only disadvantage of this approach is your XAP files containing duplicate copies of assemblies such as the ones from the SDK. But, there is a solution to this problem. The next optimization technique explains it.
2) Application library caching. All XAP files refer to one or more assemblies from SDK and are mostly packaged with your XAP file. If you had two XAP files containing the same assemblies, the duplicate assemblies will get downloaded with the XAP. Why not just cache the duplicate assemblies in browser and avoid downloading them again? That's what app library caching does. It allows you to separate out the common assemblies from the XAP and allow them to be cached in the browser. Read this blog post on configuring app library caching. In addition to the article, you can use the emm utility from here to generate the extmap files.
3) Compress the XAP better. XAP is basically an archive of files. It seems the XAP files are not compressed for download optimization, but for browser rendering optimization. You could compress them better by doing the following.
- Rename the xap extension to zip.
- Extract the zip to a folder.
- Archive it again with zip or rar formats with best possible compression ratio.
- Rename the archive back to xap
Most people have reported a much reduced XAP size, but again it depends on the content type such as image, text etc.
Good luck!
No comments:
Post a Comment