sapling/lib/commitstore/bench-serialize
Jun Wu 0cc8f5ce84 commitstore/bench-serialize: add benchmark for mincode
Summary:
Add benchmark for the newly added mincode serialization. An example run shows:

  serialize   by cbor                                32.573 ms   9.701 MB
  deserialize by cbor                                79.471 ms
  serialize   by cbor-packed                         28.574 ms   7.801 MB
  deserialize by cbor-packed                         73.337 ms
  serialize   by bincode                             25.175 ms   6.789 MB
  deserialize by bincode                             23.193 ms
  serialize   by mincode                             19.687 ms   5.389 MB
  deserialize by mincode                             24.852 ms
  serialize   by handwritten                          2.939 ms   5.389 MB
  deserialize by handwritten                          7.963 ms
  serialize   by abomonation                          1.752 ms  10.389 MB
  deserialize by abomonation                          6.060 ms

Interesting facts:
- mincode serialization is actually faster than bincode. (it would appear
  slower if vec was not preallocated).
- mincode is much slower than handwritten. This is partially caused by serde
  not having a native "fixed array" type so it cannot do `write_all(&[u8; 20])`
  but has to `write_u8(x)` 20 times (which translates to
  `Vec::extend_from_slice` 20 times.

Regardless, the main reason I think mincode is compelling is its compactness
and relatively good performance. Although handwritten is the fastest, the
mincode performance is fine in the commit storage usecase, since mincode is
probably not the bottleneck.

Reviewed By: kulshrax

Differential Revision: D17087352

fbshipit-source-id: 820ff8538d3ab9ebef2eda0a40cad126e26db622
2019-09-06 13:13:49 -07:00
..
src commitstore/bench-serialize: add benchmark for mincode 2019-09-06 13:13:49 -07:00
Cargo.toml commitstore/bench-serialize: add benchmark for mincode 2019-09-06 13:13:49 -07:00