16

When setting the properties for a silverlight app, I see the unchecked boxes:

  • Reduce XAP size by using application library caching
  • Use GPU Acceleration

Smaller download size and faster speed sound good to me, which makes me wonder why these aren't turned on by default.

What are the drawbacks of these choices then?

0

2 Answers 2

13

Reduce XAP size by using application library caching

Advantages

This reduces the XAP size by allowing those libraries configured with a dllname .extmap.xml file to be placed in individual zip files. These zip files will be requested as part of the initial XAP download.

The advantage comes in two scenarios. First if you update your code and rebuild the XAP most of the time the only thing that changes is the XAP, zip files remain unchanged. Hence when a client revisits your app and needs to download the latest version it may well be that only the XAP gets fetched, the zips being the same get served out of the browser cache (probably after a "304 Not Modified" response from the server).

The other scenario is where you have multiple SL applications on your site. They will share the same zips and therefore the total download for multiple apps is much reduced.

Disadvantages

For a one off application the first client visit will be a download at least as expensive if not more expensive than had the all the libraries been kept in the XAP. In some uses (high number of unique visitors of a site with a single app) it may be more desirable to keep the single XAP, especially if the XAP itself doesn't change that often.

Where there are multiple XAPs sharing the same set of library zips there is a danger of "DLL Hell". Potentially someone can update a XAP which uses newer versions of libraries that the other XAPS have not been tested with and inadvertently break all the other XAPS. There are good practices that can eliminate this problem but it takes a little more effort than flicking on the Checkbox.

Conclusion

In light particularly of the second disadvantage I think it was a sensible choice not to default this feature on.

Use GPU Acceleration

I'm not going to go into the advantages/disadvantages of this. Just answer why its off by default.

You don't get any advantage by just turning it on, you need to enable which elements in the XAML will get to use it via the CacheMode property. In addition depending on what you are doing this may still not bring you any advantages.

Just turning it on will consume extra resources such as video memory, you wouldn't want that to happen unless you've specfically gone ahead used CacheMode at least somewhere in your app and hopefully where it would make a real difference. Also it is possible to get it wrong and make things worse.

1
  • thanks. How can I use the CacheMode property for displaying images? would I set it on ImageViewer? Nov 18, 2010 at 22:41
2

I believe both of these features were introduced in Silverlight 3. One reason for them being opt-in is to maintain backwards compatibility.

There are instances where turning on GPU Acceleration can actually degrade performance or cause other issues. By making it an opt-in process, you are more likely to notice the consequences (good or bad) as opposed to the setting being turned on by default and wondering why your application has performance issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.