Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is incompatible with protobuf. Protobuf has variable length encodings for all its integers, including field tags.

https://developers.google.com/protocol-buffers/docs/encoding



Actually you have both 32 and 64 bit wire types:

    - wire_type=1 64 bit: fixed64, sfixed64, double
    - wire_type=5 32 bit: fixed32, sfixed32, float
Consider a valid protobuf message with such a field. If you can locate the field value bytes, you can write a new value to the same location without breaking the message. It's obviously possible to the same with the varint type too, as long as you don't change the number of bytes - not so practical, but useful for enum field which has a limited set of useful values (usually less than 128).

Pregenerating protobuf messages you want to send and then modifying the bytes in-place before sending is going to give you a nice performance boost over "normal" protobuf serialization. It can be useful if you need to be protobuf compatible, but it's obviously better to use something like SBE - https://github.com/real-logic/simple-binary-encoding




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: