Capnproto-rust vs. C++
dwrensha.github.io
dwrensha.github.io
I'm pleasantly surprised to see the object mode slightly faster than C++.
When I see this Capnproto, I am confusing that which one is right approach. Alignment is not exotic technique, and why didn't they align the data if there's no reason to save I/O?
Or am I totally misunderstanding these implementations?
Regarding the other formats you mention, I think you may be imagining that the designers of these protocols thought more carefully about them than they really did. Protobuf, for example, was designed pretty ad-hoc to solve an immediate problem in Google's search infrastructure, and then stuck mostly because as more and more things used it, it was easier to keep using it than start over. The designers readily acknowledge that it is not an ideal format -- in fact, there are other ways they could have done the encoding which would have taken no more space but would have saved significant CPU time.
(Disclosure: I was the maintainer of protobufs for a long time, though not the original creator. I am also the author of Cap'n Proto.)
https://github.com/dwrensha/capnproto-rust/blob/master/Makef...
https://github.com/dwrensha/capnproto/blob/benchmark/c%2B%2B...
I compiled libcapnp with the latest Clang g++ that ships with XCode. It perhaps would be more fair to also compile the C++ benchmarks with Clang, instead of the Macports gcc4.8 that I'm using, but unfortunately Clang barfs on some template hackery in the benchmark driver.
Switching compilers on the C++ side doesn't seem to make a significant difference in performance.