Tag Archives: DataContract

Serialization Performance comparison (C#/.NET) – Formats & Frameworks (XML–DataContractSerializer & XmlSerializer, BinaryFormatter, JSON– Newtonsoft & ServiceStack.Text, Protobuf, MsgPack)

Hi big shot!

This time I’ll talk about performance of serialization. Serialization is a common task we use mostly for communication and storage. This post will give a wide serialization performance comparison.

Real life scenarios- Lately a micro services architecture become very common, in such architecture you have to provide a way for your micro services to communicate between themselves so you’ll have to serialize your objects for that. Normally you will use messaging frameworks that will do it for you but it’s essential to understand what’s going under the hood. In other cases, you’ll need to develop a framework or a tool that will need to serialize it’s objects itself. In addition, in many communication frameworks you’re able to change the serialization method so it’s important to understand what you’ll achieve by doing so.

In this post I won’t talk about the advantages or disadvantages of each format/framework, I’ll stick strictly with performance (Space and Speed). That said, when you choose a format and framework you sure need to think about much more than that. Examples are ease of use, extensibility, flexibility, versioning, and much more.

Although my test run in C#, this post applies to any technology. The size obviously will be the same, and about the speed I believe that it will differ, but the ratio between the formats will be roughly the same in most cases.

Continue reading