Serialization performance
I've been writing a YAML serializer for .NET, and in doing some performance tests, was surprised to see the XMLSerializer is faster then the BinaryFormatter! The follow table shows the results of serializing 1000 people objects:
| Serializer | Serialized Size (K) | Run 1 (MS) | Run 2 (MS) | Run 3 (MS) | Run 4 (MS) | Run 5 (MS) | Average (MS) |
|---|---|---|---|---|---|---|---|
| yaml | 482 | 78 | 62 | 78 | 63 | 62 | 68 |
| xml | 1380 | 109 | 78 | 94 | 78 | 78 | 87 |
| binary | 278 | 125 | 125 | 141 | 140 | 141 | 134 |
| soap | 2261 | 562 | 516 | 484 | 500 | 500 | 512 |
If you use remoting, you have a choice between the SOAP and Binary formatters, you cannot use the XML one. As I understand it, ASP.NET web services use the XMLSerializer, hence ASP.NET being faster than remoting.
I like YAML. I first came across it when learning Ruby, and trying out Ruby on Rails, for some example YAML click here. YAML is a simple, compact, human readable text format. I hope it stays simple, unlike SOAP...

0 Comments:
Post a Comment
<< Home