What are packed repeated fields in Protocol Buffers and why do they improve efficiency?
Last updated
Packed encoding stores a repeated scalar field as one tag plus one length, followed by all values back-to-back, instead of a tag before every element.
It only applies to repeated numeric scalars (ints, floats, bools, enums). It is the default in proto3 and enabled via
[packed=true]in proto2.Parsers accept both packed and unpacked forms, so switching is wire-compatible.