...
- Field numbers are serialized with data:
- Do not send null fields, ignore unknown fields.
- Order of fields isn't guaranteed: message can be concatenations of same fields in different order. For optimizations (compression)?
- Make possible easily change schema (but user must preserve field ids).
- Serializer must know len of varlen fields (Messages).
- It can be worked in streaming way using CodedOutputStream. To customize serialization, but it still requires len for Messages be written before.
- It allows deserialize only required fields using CodedInputStream. It requires writing a code for iterating over tags and skipping fields.
FlatBuffers
https://flatbuffers.dev/internals/
- Offsets are serialized with data:
- Order of fields is not guaranteed - for optimization like compaction.
- First 4bytes - offset to the root of vtable, that stores offsets to other fields. Vtable can be anywhere relative to fields.
- Size of data must be know before serializing to prepare the vtable.
- It starts serializing from nested objects, calculate it sizes and fill tables, and then write root object.
- No streaming is possible.
Avro
Bson