opensourcerouting / c-capnproto

C library/compiler for the Cap'n Proto serialization/RPC protocol
MIT License
118 stars 40 forks source link

Small-size data serialization problem #31

Open yunhua-deng opened 5 years ago

yunhua-deng commented 5 years ago

According to our experiments, if the size of the raw message is less than 200 bytes, cap'proto gets slower than protobuf. The reason could be the overhead taken by the malloc process invovled in the deserializing each message?

yunhua-deng commented 5 years ago

Actually, we are benchmarking the c-capnproto, and seeing that in deserilization there is some malloc overhead, https://github.com/opensourcerouting/c-capnproto/blob/master/tests/example-test.cpp#L98

For 4000000 messages with each of about 200 bytes in size, the serilization/deserilization times are as follows:

protobuf: 650/750ms capnp: 280ms c-capnp: 500/900ms

FYI: We have fired an issue in c++ capnproto https://github.com/capnproto/capnproto/issues/790#issuecomment-458263599