capnproto-rust
capnproto-rust copied to clipboard
Is there any benchmark?
such as throughput compared with gRPC?
For the base serialization crate, there was this benchmark a long time ago: https://dwrensha.github.io/capnproto-rust/2014/01/15/benchmark-update.html . The benchmark code is still checked in, in the benchmark/ directory.
For the capnp-rpc crate, I am unaware of any benchmarks.
I added capnproto to llogiq's serdebench some while ago.
However, results on my machine weren't so hot compared with flatbuffers, so maybe I did something wrong?
@dureuill Thanks. I opened https://github.com/llogiq/serdebench/pull/4.
I suspect one of the reasons that flatbuffers deserialization appears to be faster is that capnproto-rust is doing utf-8 validation but (as far as I know) flatbuffers is not. I wonder if we should adjust the API of capnp::text::Reader so that consumers don't need to perform that validation if they don't want to. (This isn't the first time that the validation has noticeably shown up in a benchmark.)
On closer examination, the utf-8 validation does not look as significant as I had initially thought. I now suspect it's mainly the pointer indirection that's expensive for capnproto-rust, and reading a List(Text) involves a lot of pointer indirection.