Note: these are early notes based on some initial experiments with the Silverlight 5 beta, apply a pinch of salt to what you read.
If you search the web for something like “Silverlight windowless performance” you’ll find a bunch of articles that talk about how you want to avoid using Silverlight in Windowless mode in the browser for performance reasons.
The main reason why you’d use windowless mode in the first place is when you want to overlay Silverlight content on top of HTML content and, usually, there’s a performance penalty to pay for this because the browser has to take over the rendering and do the work of blending the Silverlight content with the HTML content that might reside “beneath it”.
With Silverlight 5 and IE9 though, that changes as IE9 uses hardware acceleration and Silverlight 5 can plug into that and take advantage of it. As a way of illustrating this, I thought I’d revisit my “whimsical” sample that I did earlier in the year and see how it worked in IE9 with windowless mode.
I altered my sample a little in order that it produces 100 ellipses of random colour and I ran it a few times to check out its performance.
1) Run 1 = Windowed, No GPU Acceleration
the performance here doesn’t look too bad until you realise that the counter is showing 165% cpu utilisation (across my 2 CPUs) so it’s actually a lot worse than it looks!
2) Run 2 = Windowed, GPU Acceleration
Wow, that’s a lot better. I go from 165% down to around 12% with a single flag.
3) Run 3 = Windowless, GPU Acceleration
You can see here the blend of the HTML and the Silverlight content;
and the CPU graph for this monster looks like;
and so we increased things quite a bit but we’re still running around 35% even though we’ve moved to windowless mode.
4) Run 4 = Windowless, GPU Acceleration in Chrome
Here’s Chrome running the same sample where there are 2 proceses involved adding up to around about 80% CPU utilisation – note, I’m not taking cheap shots at Chrome here as IE8, 7, 6 would all exhibit similar behaviour. It’s only IE9 that works magic here;
5) Run 5 = Windowless, GPU Acceleration, FireFox
where there are again 2 processes involved adding up to about 140% CPU utilisation.
So, all in all, this is a positive thing for IE9 and Silverlight 5 which opens up some possibilities around what you might be able to do in a performant manner with windowless mode.
Here’s the example running in the page – if you’re in IE9 this should use a lot less cycles than other browsers so apologies if you’re viewing this and your CPU goes crazy
Tue, Apr 26 2011 2:26 PM