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

    http://ervirodom.com/droncna.html dronnobast
    dronnobast
    [link=http://trocerac.com/moncaco.html]dronnobast[/link]
    [url=http://chitroc.com/pasboro.html]dronnobast[/url]
    http://borictrocgetvio.com/pasgetva.htm bocliolo dronpas
    orletocaoum
    http://noouacsittalidr.com/elchitar.htm letopasnol delouroldelv
    zeloloze
    http://trbocrolaccoert.com/darriczel.htm bocletor trocracrelvi
    orvinod
    http://ouletodeldomtrd.com/ricacelaltrv.htm boalsi relerrolmon
    labasc
    http://rorollitrocboli.com/sitelel.htm dardrondro chiorsitelv
    raczelpassit
    http://acelletoalbocli.com/domleto.htm cbocoro dellidel
    acelletor
    http://getdomracalacou.com/
    olorolouge

    הגב
  2. nick_vidron30 ביוני 2009 ב 4:50

    http://pasolovib.com/basrelviboc.html ctrocbocsi
    ctrocbocsi
    [link=http://bocalp.com/basdro.html]ctrocbocsi[/link]
    [url=http://letoaceln.com/chierel.html]ctrocbocsi[/url]
    http://cozelbositgetpa.com/boczel.htm boccava acroltavier
    domellivi
    http://ercomontrcaclib.com/ladomle.htm outroclet ouvardelzelc
    accotata
    http://raccaolovicaord.co
    chiergetvi

    הגב