by maxmuen · 2y ago · 0 comments
[1]: https://www.rfc-editor.org/rfc/rfc9000.html#name-variable-le...
The QUIC method adds 2 bits and then rounds up to the nearest power of two bytes. On values up to 62 bits it wastes 0-4 bytes, and it wastes 1-4 bytes when you give it a multiple of 8 bits.
The rounding has a much bigger impact than the bits directly used to encode length.
Storing the number 100 (decimal) under the QUIC scheme would require 2 bytes, but only 1 byte under either "metric" or "imperial" varints.
(same for any value between 64 and 127, I believe (I might be off-by-one there...))
Which led me to believe I might be wrong, but I just double-checked and I'm definitely right. Anyone care to explain?