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
To really answer this question, the reason why the C++ version is slow is that it calls the ostream.write
too many times, which induce a huge amount of unnecessary state checks. You can create a simple buffer and use only one write
and you will see the difference.
If your disk/network is really fast enough to not become the bottleneck, flatbuffers capnproto are great options to handle this for you.
Otherwise, protobuf, xxx-compact
... whatever uses varint encoding can probably serialize these data to a quarter of the original size.
HPS from the scientific computing community is also a great option for this kind of highly structured data and probably the fastest in speed and the smallest in message size in this case due to its encoding scheme.