Pre-allocate storage in http2::HuffmanEncode().

Also, do not call http2::HuffmanEncode() in
QpackInstructionEncoder::DoStartString() if it does not result in size savings.

Note that performance gets worse for short strings, presumably because
std::string::reserve() for small values is a no-op due to small string
optimization.  However, I plan to modify http2::HuffmanEncode() not to clear the
output string and modify QpackInstructionEncoder to avoid copying, which should
result in a performance improvement overall.

Also I'll add a slightly faster implementation in the next CL, so this is really
only to change the API to make tests simpler.

PiperOrigin-RevId: 334909897
Change-Id: Idd7414c0dcaa56fc62d0822ec06250d480d2972c
6 files changed
tree: 75d1870f7d330ea6d488becfbddeecea1215c2f1
  1. common/
  2. epoll_server/
  3. http2/
  4. quic/
  5. spdy/
  6. CONTRIBUTING.md
  7. LICENSE
  8. README.md
README.md

QUICHE

QUICHE (QUIC, Http/2, Etc) is Google‘s implementation of QUIC and related protocols. It powers Chromium as well as Google’s QUIC servers and some other projects.