Variable-Length Integers in Go
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
This Go-focused article benchmarks six variable-length integer encodings, including Protobuf's LEB128, QUIC's two-bit length prefix, and OmniBuf's trailing-zero prefix scheme. It explains why varints matter: fixed 64-bit integers waste space on small values, and encoding several integers together requires knowing each length.