[HN Gopher] Fast and dynamic encoding of Protocol Buffers in Go
___________________________________________________________________
Fast and dynamic encoding of Protocol Buffers in Go
Author : g0xA52A2A
Score : 36 points
Date : 2023-02-06 14:01 UTC (9 hours ago)
(HTM) web link (vincent.bernat.ch)
(TXT) w3m dump (vincent.bernat.ch)
| bamazizi wrote:
| This project does have potentials. We were using Gogo up until a
| few months ago until it was deprecated and replaced the pipeline
| with Buf.build. It took several days of head scratching but once
| we figured it out it was basically ZERO code change in 100s of
| proto and Go files.
|
| If vtprotobuf would be adopted as an optional compile module in
| Buf then I would love try it. I just don't think we would want to
| move away from Buf.
| jeffbee wrote:
| Very nice! Puts together many of my favorite protobuf techniques.
| I am glad that people do not feel that they are required to use
| generated code when they choose the protobuf format.
|
| One thing I will quibble about is the representation of the tag
| number 19, named SrcCountry. The author shows it as binary
| 10011010 but this is impossible because protobuf tags are
| themselves encoded as continuation bit variable-length numbers
| and cannot end in a byte with the most significant bit set.
| That's why fields 1-15 are the magic fast-path fields taking only
| 1 byte. Field 19 would need two bytes... 10000001_00011010 or in
| hex 81 1A
| vbernat wrote:
| Author here. The tag is shown not encoded as a variable int (I
| admit this is not super clear). Its encoded version is 0x9a
| 0x01. I think this is correct. This the result of (19 << 3) + 2
| encoded as a varint.
| jeffbee wrote:
| Oh I see, the thing on the left is logical and the thing on
| the right is on the wire. Thanks for helping me read it.
| everybodyknows wrote:
| > There exist other alternatives, including Cap'n Proto, CBOR,
| and Avro.
|
| The names of the alternatives are links to references.
|
| All technical articles should start this way, well done.
| irq-1 wrote:
| > Some paragraphs were editorialized by ChatGPT, using
| "editorialize and keep it short" as a prompt. The result was
| proofread by a human for correctness. The main idea is that
| ChatGPT should be better at English than me.
|
| This should be at the TOP not at the end.
___________________________________________________________________
(page generated 2023-02-06 23:02 UTC)