Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Field numbers are serialized with data:
    1. Do not send null fields, ignore unknown fields.
    2. Order of fields isn't guaranteed: message can be concatenations of same fields in different order. For optimizations (compression)?
    3. Make possible easily change schema (but user must preserve field ids).
    4. Serializer must know len of varlen fields (Messages). 
  2. It can be worked in streaming way using CodedOutputStream. To customize serialization, but it still requires len for Messages be written before.
  3. 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/

  1. Offsets are serialized with data:
    1. Order of fields is not guaranteed - for optimization like compaction.
    2. First 4bytes - offset to the root of vtable, that stores offsets to other fields. Vtable can be anywhere relative to fields.
    3. Size of data must be know before serializing to prepare the vtable.
    4. It starts serializing from nested objects, calculate it sizes and fill tables, and then write root object.
  2. No streaming is possible.

Avro

Bson