Rogiel / PacketBuffer

PacketBuffer is a C++14 header-only library designed specifically to be really fast at processing binary network packets.
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

Comparisons, benchmarks... #1

Open DJuego opened 6 years ago

DJuego commented 6 years ago

Thank you for your contribution, @Rogiel . It is interesting.

IMHO, a good idea could be to compare with another alternatives: Cereal, msgpack,... in terms of functionality and/or performance, advantages and disadvantages and so on. 👍

DJuego

Rogiel commented 6 years ago

This is something I want to do, I just didn't had the time to do it yet.

Cereal will definitely be faster, because it does not have to consider endianness (which might make it not proper for networking). As for MessagePack, it is really good for data that changes a lot, but for a more stable networking protocol the overhead of encoding the types and behaving somewhat like a JSON object is unnecessary.

In PacketBuffer there is no versioning, there are no types encoded with the data. It is very barebones. There are only primitive types (with a well defined cross-platform encoding format) and composed types (like STL containers) built on top of them. I like to see PacketBuffer as an enhanced memcpy that can deal with complex objects like std::vector and endianness-aware.

A std::vector<uint16_t> will be encoded as a uint32_t containing the std::vector<uint16_t>::size() followed by each uint16_t one after the other.

gsaibro commented 6 years ago

Muito bom Rogiel.