Performance issues in Silverlight 2 Animations

20 בנובמבר 2008

3 תגובות

Performance issues in Silverlight 2 Animations

I had to fix a problem in a Silverlight application we are building. The problem was that it’s CPU usage was constant, between %20 and %40, and never stopped. I won’t go into the details of on how much time it took me to understand the reason of the problem, but I’ll tell you what the problem was, and how we solved it.

Scenario :
A dynamic content application that requests asynchronously a web service. While the request is made, the application shows a small spinning animation. When the request is done, the application removes the spinning animation and replaces it with the content. The spinning animation is composed of a tiny XAML and loops forever.

The problem:
When the animation is removed from the page, the animation keeps looping until the garbage collector reclaims it, and that might take a long time. So the CPU usage was wasted due to that invisible animation which was no longer used.

The solution:
Before replacing the animation with the content, I had to stop the animation. That solved the problem.

The Why:
Unfortunately, Silverlight controls doesn’t implement IDisposable, so you can’t just stop the animation in a Dispose method. You have to do this manually.

I hope Silverlight makes each DependencyObject or UIElement implement IDisposable in the near future.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

3 תגובות

  1. nick_bonosi30 ביוני 2009 ב 4:49 dronnobast
    [url=]dronnobast[/url] bocliolo dronpas
    orletocaoum letopasnol delouroldelv
    zeloloze bocletor trocracrelvi
    orvinod boalsi relerrolmon
    labasc dardrondro chiorsitelv
    raczelpassit cbocoro dellidel

  2. nick_vidron30 ביוני 2009 ב 4:50 ctrocbocsi
    [url=]ctrocbocsi[/url] boccava acroltavier
    domellivi outroclet ouvardelzelc