fastest c++ serialization?

后端 未结 11 1516
自闭症患者
自闭症患者 2021-02-18 17:57

Good morning all,

I\'m searching for a very fast binary serialization technique for c++. I only need to serialize data contained in objects (no pointers etc.). I\'d like

11条回答
  •  旧时难觅i
    2021-02-18 18:36

    Well, if you want the fastest serialization possible, then you can just write your own serialization class and give it methods to serialize each of the POD types.

    The less safety you bring in, the faster it'll run and the harder it'll be to debug, however there is only a fixed number of built-in, so you could enumerate them.

    class Buffer
    {
    public:
      inline Buffer& operator<<(int i); // etc...
    private:
      std::deque mData;
    };
    

    I must admit I don't understand your problem:

    • What do you actually want to do with the serialized message ?
    • Are you saving it for later ?
    • Do you have to worry about forward / backward compatibility ?

    There might be better approaches that serialization.

提交回复
热议问题