Thanks to Masykur (MVP ASP.NET – Indonesia) for pointing this out: Silverlight ePaper causes high CPU usage when hovering mouse over the text.
I have the solution to that (and a video to prove it), but first let me blame Microsoft for this point:
Silverlight uses CPU Rendering to redraw screens instead of Graphics Card (unlike DirectX or WPF).
Yes, they say Silverlight 3 supports GPU Acceleration, but I wonder on which cards it works (EnableCacheVisualization doesn’t seem to work on my Lenovo T400 and MacBook Pro, but on a Kompas.com engineer laptop it works).
So here’s my Silverlight Performance Tip: adjust your FrameRate according to your media. Since my media is static, I use 15fps. If you use video, make sure the video framerate matches Silverlight’s framerate. The default is 60fps.
So I guess that means on the default scenario, Silverlight will redraw my mouse cursor 60 times a second. That is not necessary as I don’t need the smoothness.
Here’s the video to show that 15fps is a big improvement than the default 60fps:
On the default 60fps, you can see the CPU usage jumped to 24% (this being on QuadCore with 8GB RAM).
On the custom 15fps, you can see the CPU usage is always below 10%.
You need to maximize the video to see the numbers…
Oh, here’s the code to make the changes:
void Main_Loaded(object sender, RoutedEventArgs e)
{
var host = Application.Current.Host;
var settings = host.Settings;
// Performance Visualization
settings.EnableFrameRateCounter = true;
settings.EnableRedrawRegions = true;
settings.MaxFrameRate = 15;
}