Binary serialization/de-serialization in C++ and C#

前端 未结 3 460
伪装坚强ぢ
伪装坚强ぢ 2021-01-19 02:42

I am working on a distributed application which has two components. One is written in standard C++ (not managed C++ and running on a Linux platform) and the

相关标签:
3条回答
  • 2021-01-19 03:18

    gzip won't directly help with serialization - it will just (attempt to) shrink a stream. This may help, or not, depending on the amount of duplicated data in the stream. For dense data with little text, I've seen gzip increase the size of the payload.

    Personally I would look at protocol buffers here (but I'm biased, as I'm one of the authors of the many extensions). You typically (but not always) define the messages in a basic language (a .proto file), and run language-specific tools to generate the classes. Performance is very good - focusing on .NET it can far exceed the inbuilt serializers (1 2 3 )

    0 讨论(0)
  • 2021-01-19 03:21

    Another possibility would be Thrift, it has even more backends and if necessary provides a good part of the code required for network communication - in case you want to scale out.

    If you only want easy object serialization I would have a look at json.org There are plenty of C++ / .NET implementations around.

    0 讨论(0)
  • 2021-01-19 03:36

    I would recommend Protocol Buffers, which is Googles own serialization library. It has both .Net, C++ and Java serializers. Most implementations are also quite fast.

    http://code.google.com/p/protobuf/

    0 讨论(0)
提交回复
热议问题