Comment by secondcoming

5 years ago

What benefit would length encoded headers provide other than to reduce payload size? With JSON you just have to scan for whitespace, whereas with protobuf you actually have to decode the length field.

Not having to look at every byte to split out the contents.

  • Right, a protobuf message that consists of a single 100MB string will be "decoded" dramatically faster than 2GB/s, because you only need visit the tag and the length and store the address and length, aliasing the input.

    It's really quite impossible to discuss data encoding performance outside of a given schema.