I couldn't find super clear info on this in the docs or online (feel free to point me in the right direction though), but does the ordering of fields in a protobuf message (using syntax = proto3
) affect the resulting on-the-wire size? For example, say I have the following message:
message Message {
int x = 1;
string y = 2;
}
If I specify this as
message Message {
string y = 1;
int x = 2;
}
will the resulting compiled on-the-wire size change for doing something like Message {x = 1, y = "foo"}
under the two message specs differ or will they be the same?
How does this work with repeated
fields? For example
message Msg {
int x = 1;
repeated string strs = 2;
}
vs
message Msg {
repeated string strs = 1;
int x = 2;
}
In this case is it more beneficial to put the repeated
field first or the int
field?