capnproto-rust icon indicating copy to clipboard operation
capnproto-rust copied to clipboard

Is there any benchmark?

Open Praying opened this issue 5 years ago • 11 comments

such as throughput compared with gRPC?

Praying avatar Jul 21 '20 05:07 Praying

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.

dwrensha avatar Jul 21 '20 21:07 dwrensha

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 avatar Oct 19 '20 21:10 dureuill

@dureuill Thanks. I opened https://github.com/llogiq/serdebench/pull/4.

dwrensha avatar Oct 19 '20 23:10 dwrensha

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.)

dwrensha avatar Oct 19 '20 23:10 dwrensha

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.

dwrensha avatar Oct 20 '20 00:10 dwrensha