Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Avoid having default values in XAML to do less during Load.

I worked with a part of the VS2010 team recently to improve XamlReader.Load performance for an important scenario.  It was taking 120ms to load a XAML file and create the objects that it specified.  It seemed like the XAML was a bit verbose, so I wrote a quick tool to analyze the types, properties and values used.  Digging in, I was able to see that many properties were set on every instance of that type, and usually to that same value.  That was a clue that the DefaultValueAttribute of many of the properties was not set appropriately.

A few days later, I heard of 2 improvements that helped perf of this scenario (measured in warm start scenarios, I believe):

  • moving to the System.Xaml.dll engine improved this scenario from 120ms to 72ms
  • fixing the default values, and thus loading a smaller XAML file, took it down from 72ms to 38ms

We will still try to help them reduce the time more, but we’re really happy with the progress so far.  It is also exciting to see VS adopting XAML in their UI and for several other scenarios as well.

We’re really happy of our current XAML to Object performance of the new XAML stack…we continue to profile many scenarios and figure out other ways to get more speed.  Our BAML to Object performance right now isn’t where we need it, so we are actually investing more optimization/profiling time there right now…

Getting the XAML Analysis Tool

The tool I wrote uses System.Xaml.dll, so I won’t ship it yet…but I’ll provide my little utility as it may help others understand how their XAML Vocabulary can be improved.

Published Friday, February 13, 2009 4:15 AM by Rob_Relyea

Comments

# re: Avoid having default values in XAML to do less during Load.@ Friday, February 13, 2009 8:15 AM

Rob,

At work we're dealing with a lot of XamlReader.Load() calls. I'm looking forward to try the new version of System.Xaml.dll, do you have any timeline about the first public beta ?

by Jeremy

# re: Avoid having default values in XAML to do less during Load.@ Friday, February 13, 2009 9:41 AM

Jeremy-

The next public release of .NET 4 will have it.  The last public release of .NET4 was at PDC2008, but System.Xaml.dll wasn't in that build.

I don't think the date is public info right now...but we are all working hard towards that next preview!

Note - while XAML to Object should be faster across the board, not all scenarios will be as improved as the scenario I describe above...

Thanks, Rob

# Avoid having default values in XAML to do less during Load@ Friday, February 13, 2009 11:53 AM

Thank you for submitting this cool story - Trackback from DotNetShoutout

# re: Avoid having default values in XAML to do less during Load.@ Saturday, February 14, 2009 11:17 AM

As a designer who produces XAML for Silverlight apps, could you explain (in words of 2 syllables or less :) just what this means - or even better an example of good code versus bad?  Is this only relevant when using XamlReader in the code behind, or also applicable to static user controls etc?

# Dew Drop - February 14, 2009 | Alvin Ashcraft's Morning Dew@ Saturday, February 14, 2009 7:22 PM

Pingback from  Dew Drop - February 14, 2009 | Alvin Ashcraft's Morning Dew

# re: Avoid having default values in XAML to do less during Load.@ Thursday, February 19, 2009 1:01 PM

Would love to see this utility/tool that you wrote ... let us know when you can release it!

by Cory

# re: Avoid having default values in XAML to do less during Load.@ Friday, February 20, 2009 5:47 AM

Hey Rob,

See this I wrote in 2007.

blog.galasoft.ch/.../Cleaning-up-XAML-code-and-improving-parsing-time-with-Blend.aspx

Always a good trick ;)

Laurent

by Laurent

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter