Re:gRPC: The Bad Parts
by hot_gril on Thursday June 27, 2024 @01:59PM
(#40813209)
Won't work if your struct has any pointers in it.
[ Parent
| on HN ]
I'd recommend not doing that then. Of course the same is true if you coerce a pointer to an int64 and store it in a protobuf.
It's not the pointers themselves so much as what they're typically used for. How would you do dynamic sizing? Imagine sending just a struct of integer arrays this way, you'd have to either know their sizes ahead of time or just be ok with sending a lot of empty bits up to some max size. And recursive structures would be impossible.
You could get around this with a ton of effort around serdes, but it'd amount to reinventing ASN1 or Protobuf.
A lot of protocols in low latency trading systems just have fixed maximum size strings and will right pad with NUL or ASCII space characters.
Packed structs with fixed size fields, little endian integers and fixed point is heaven to work with.