XamlWriter Performance: Update

About a month ago, I blogged about Xaml serialization, and pointed out a discrepancy between the performance of XamlReader and XamlWriter.  Simply put, serializing WPF objects with XamlWriter is much slower than loading the same objects with XamlReader.  (as of the RC1 bits)  This is somewhat understandable considering how important the Xaml parser is to the framework, but at 5 to 9 times slower, I pointed out that XamlWriter could use some serious love.

Unfortunately, however, I was informed that XamlWriter optimizations were not going to make the release window.

Enter Rob Relyea, Program Manager in the WPF group at Microsoft.  Not content to let ‘sucky’ performance prevail, Rob whipped up a sample implementation of XamlWriter using the underlying APIs.  To make a long story short, it’s twice as fast as the built in XamlWriter, and in my testing seems to work well with a wide variety of WPF objects.  Thumbs up from the developer community Rob – I’m glad Microsoft has people on the job who have obvious passion for what they’re doing.

The code sample is not complete, but it should be trivial to add your own implementation of the methods you require.  The code can be found in this thread in the MSDN forums.


One Response to XamlWriter Performance: Update

  1. Anti-Tank says:

    I would like to join in this discussion on performance.

    In the event when I need to load a 10 MB XAML file within 2 seconds. Are there any enhance XAMLReaders in the market now that is capable of such performance requirement?

    I have tested with the XAMLReader provided. It simply is incapable of such performance need.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: