iobuf: change the way to handle reserve bytes

  Currently, iobuf allocator reserves the space only when it allocates
  the first slice from the internal buf. Also we do not set the 'reserve'
  correctly. E.g., zero reserve in crypto where it is necessary), and
  header+macsize in vc.newWriter where it isn't.
  This leads unnecessary data copy for header+mac insertion and may prevent
  coalescing due to the reserved space.

  This CL change iobuf allocator to always reserve the space when
  requested, and give the correct 'reserve' bytes to each alloc.

                                      old                        new
  RPC Connection                      13.72 ms/rpc               13.70 ms/rpc              -0.1%
  RPC (echo 1000B)                    1.03 ms/rpc (971.45 qps)   1.02 ms/rpc (979.03 qps)  -1.0% (0.8%)
  RPC Streaming (echo 1000B)          0.11 ms/rpc                0.11 ms/rpc                0.0%
  RPC Streaming Throughput (echo 1MB) 293.60 MB/s                328.45 MB/s               11.9%

Change-Id: I081579544540771cf2dfe7aaa433f1a2c5d0f8f2
10 files changed
tree: af0fb549b90c85a50b2d3ab17683ce463dbb596d
  1. cmd/
  2. examples/
  3. internal/
  4. lib/
  5. runtime/
  6. services/
  7. test/
  8. .gitignore
  9. AUTHORS
  10. CONTRIBUTORS
  11. envvar.go
  12. envvar_test.go
  13. LICENSE
  14. PATENTS
  15. README.md
  16. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.