News for hackers. Stuff that matters.
Re:Demystifying the protobuf wire format by lowbloodsugar on Friday May 17, 2024 @12:31PM (#40391621)
The sizes are computed by traversing the object tree before writing it. If you wanted a super fast implementation you could reserve space for a, say, three byte VarInt and then write it as three bytes no matter what. A VarInt that is four bytes can still validly represent the number 5, even though that would normally take one byte.

The thing that pisses me off about protobuf is that the wire format doesn’t distinguish between different types of binary data: if it said “this is an object binary” then we could decompose it, even if we didn’t have the protocol definition. As it is, could be a string or an array or an object.

There are no comments on this comment yet.