Feed Icon  


  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics


Open Source Projects




Posted in at Friday, October 17, 2003 2:21 AM Pacific Daylight Time

As someone who has done a lot of work in the past with SqlXml, .Net's Xml Serialization feature has always been an interest of mine. I was always wondering what kind of performance you could get using FOR XML queries and Xml De-serialization. Well after reading the section about this in Dino Esposito's book Applied Xml Programming I decided to play around with this some and see how it worked.

I started with Dino's Sql2Class example which grabs employees from the Northwind database and populates an employee object. This test class showed the Xml Serializer taking about 4 times as long as some ad hoc code that parsed the Xml. This was interesting, however, I wanted to compare the serializer performance verses standard data access techniques. So I made my own Sql2Class test project.

For my standard data access code I used Scott Watermasysk's data access code in .Text. For the SqlXml data access code I just used the System.Xml.Serialization.XmlSerializer class and FOR XML EXPLICIT queries in the database. Below is a screenshot of my test app which shows the scores for 100 iterations.

As you can see, the serializer is slower than the standard data access code. However, I think it is fast enough to be usable.

One interesting item was that parsing dates using the serializer seems to be very slow. I tried replacing the serializer's date parsing routines with my own by slightly changing the name of the HireDate and BirthDate attributes in the Xml and then adding an XmlAttributeEventHandler method. This did speed up performance by about 20-40ms. I'm not sure why this would be true since my own date parsing just uses the standard DateTime.Parse method.

So I'll keep playing around with this stuff. If anyone is interested I can post the source for my test project which runs off the Northwind database.

Personally I think this is all going to get much more interesting when Yukon goes to public beta.

Comments are closed.