5 ms·
In C# why use Protocol Buffer over the XML or binary serializes?
by wehadfun 10y ago
In C# why use Protocol Buffer over the XML or binary serializes?
- bmm6o 10y agoPerformance and data size are much better with protobufs: http://stackoverflow.com/questions/549128/fast-and-compact-object-serialization-in-net http://stackoverflow.com/questions/549128/fast-and-compact-o.... Built-in serializers are only workable when both ends are on the same platform (i.e. .Net), and even then class versioning can be a problem.
- klodolph 10y agoThe C# binary serializer is not really comparable in terms of what it does. It's more like Python's Pickle library. http://stackoverflow.com/questions/703073/what-are-the-deficiencies-of-the-built-in-binaryformatter-based-net-serializati http://stackoverflow.com/questions/703073/what-are-the-defic... C# binary serialization is only useful in certain circumstances. It doesn't work outside the .NET world and it even has compatibility problems within the .NET world—you can break deserialization by making certain changes to your code. From the Microsoft documentation: > The state of a UTF-8 or UTF-7 encoded object is not preserved if the object is serialized and deserialized using different .NET Framework versions. (From https://msdn.microsoft.com/en-us/library/72hyey7b(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/72hyey7b(v=vs.110)....) Also see https://msdn.microsoft.com/en-us/library/ms229752(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/ms229752(v=vs.110)....
- recursive 10y agoYour message will be about 5% the size of the xml one, and it will be backwards compatible, unlike the built-in binary serializer.