Solibulo

Uninteresting things

Silverlight 2 basic performance test for procedural animations

by softlion 5. November 2008 21:31

Today I created my first Silverlight 2 application and my first control : a simple ball. The aim was to evaluate how easy it is to create a Silverlight 2 application and a control, and to test SL display smoothness and speed.

The ball has an update method which is called for each ball instance at most every 25ms through the application's CompositionTarget.Rendering event. I don't know if it is the best way to do procedural animation, but it sure is a way.

This event fires before each frame is rendered, like the well known frame technics in Flash. But unlike Flash, the frame rate is not constant and depends on the running machine and the silverlight application load.

I may try later using a worker thread and the InvalidateArrange() call combination. 

 

This application displays the framerate computed over the last second, creates a new ball object each time the mouse is moved over its window, and displays the total number of balls created and animated.

 

If you take a look at the result, you'll immediatly see that frame displays are not synchronized with the graphic card's vertical sync, which results in ugly breaks in the animation.

The animation slows when the mouse is moved over it : that confirms what the documentation says about the CompositionTarget.Rendering event, so we can not complain Sealed

 

 

 

Please post your FPS, ball count, and OS in the comment section.Try to get exactly 1000 or 2000 balls.

 

References

How to declare a Custom User Control from a XAML page

This app uses a fixed version of PathTextBlock silverlight control to display a text with a stroke (in fact this control converts text to glyphs which does support stroke and fill).

Configure IIS for hosting Silverlight 2 applications (don't forget to stop/start your IIS server after)

Silverlight 2 control lifecycle

 

 

Tags: