I’m obsessing with performance.. don’t I? 😉
Again a fresh debate. Working on a new project I’ve had the pleasure of teaming up with new developers and also new discussions. The latest one was regarding serialization and performance in C#, more specific Windows Store Apps. I was showing an example of the frustrating process of serializing and deserializing in WinRT and he noticed that had had chosen to use XmlSerializer class and commented on that.
The thing is, that when I first created an example of serialization in WinRT I had used the DataContractSerializor and had gotten some comments on the MSDN forum that it wasn’t the recommended way out of a performance perspective. And sure enough, MSDN says:
From a performance perspective, we recommend using the XmlSerializer class. The XmlSerializer has the lowest serialization and deserialization times, and maintains a low memory footprint. The XmlSerializer has few dependencies on the .NET framework; this means that compared with the other serialization technologies, fewer modules need to be loaded into your app to use the XmlSerializer.
My colleague was quick to google up some performance comparisons but the numbers varied greatly, and some of the articles were rather ‘old’. But I agree with the input, as I also thought that DataContractSerializer While it isn’t the fastest it was faster than XmlSerializer. But honestly, I can’t even remember where I had that information from. I haven’t got the time to do some performance tests right now with DevReach next week I’m a bit stressed out, but I definitive will do and post on the blog. SO as for now I’ll just go with the MSDN recommendation- but please share if you have any recent performance comparisons!