Perf Debugging Tips: EnableRedrawRegions & a performance bug in VideoBrush
Was chatting with Andy Beaulieu at Remix Boston, and he was commenting that it seems that Silverlight only draws when needed -- it is true, we try to not waste your CPU cycles. For Perf debugging, a way to tell when you are causing a redraw is to turn on the control's EnableRedrawRegions property.
agControl.settings.EnableRedrawRegions = true;
With this feature on, when a section of the plugin causes a draw, that section will draw in a different color. This setting is not for those susceptible to seizures =P
Bug found: With this setting, I investigated a performance issue with VideoBrush . In our 1.0 Silverlight bits, VideoBrush always requests a redraw in the next frame. This is a bug. Unfortunately, if the control framerate is set to the default (60 fps), then any VideoBrush will be redrawn 60 times in a second. In actuality, VideoBrush should draw at the framerate that its media is getting refreshed (eg. 30fps, 15fps, or 0fps if paused), and should not take up so many CPU cycles. We have a fix for this bug in 1.1. If you are blocked by this bug, please let me know and I can pass the info along to our servicing team.
[update] By the way, this bug was fixed in a servicing pack in dec 2007.
A workaround is to set the framerate on your Silverlight control to be the same as the framerate of your video. There are visual artifacts to this workaround, but it is slight
Sys.Silverlight.createObjectEx({
source: "xaml/Scene.xaml",
parentElement: document.getElementById("SilverlightControlHost"),
id: "SilverlightControl",
properties: {
width: "500",
height: "500",
background: "black",
framerate: "30" //only as much as needed
}
Comments
Anonymous
October 07, 2007
PingBack from http://www.artofbam.com/wordpress/?p=5981Anonymous
October 12, 2007
The comment has been removedAnonymous
October 16, 2007
On Monday I joined Brad on stage at the Boston Remix conference to show a preview of Moonlight . As youAnonymous
January 18, 2008
Seema Ramchandani gave a talk back at ReMIX07 in Boston which conflicted with my "Real World Silverlight"Anonymous
January 18, 2008
The comment has been removedAnonymous
February 14, 2008
Silverlight 1.0 has no intrinsic controls. Forget about dropdowns and sliders, Silverlight 1.0 doesn