Open dsnet opened 5 years ago
@dsnet sorry if this is a something you have already thought about, I am not familiar with new code base.
There are whole lot of XXX fluff in a current protobuf, maybe bite the bullet and offload all of them into _xxx *ProtoMeta
special struct (and add "GetXXX() *..." call). Or export it, but then you can accidentally set it, not sure if this is an intention.
Variations of what you suggest is already implemented in v2. The v2 generator does not emit any XXX fields or methods.
(Background: #856)
XXX_unrecognized
is the internal field used to implement unknown fields. The current type is a[]byte
, which occupies 24B on 64-bit systems. However, the vast majority of situations do not have any unknown fields to store, so this is an increase of 24B that is mostly useless.Consider changing this to be a pointer instead (perhaps
*[]byte
), to reduce the footprint to 8B.