Naru41 parent
Why not just use a naive struct from the beginning? memcpy is the fastest way to get serialize into a form that we can use in actual running program.
The article goes into great detail about the benefits of an opaque api vs open structs. Somewhat unintuitively open structs are not necessarily the “fastest” largely due to pointers requiring heap allocations.
Opaque APIs can also be “faster” due to lazy loading and avoiding memcpy altogether. The latter appears in libraries like flat buffers but not here IIRC.
> memcpy is the fastest way
To bake endianess and alignment requirements into your protocol.