top | item 42438386

(no title)

Naru41 | 1 year ago

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.

discuss

order

schmichael|1 year ago

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.

akira2501|1 year ago

> memcpy is the fastest way

To bake endianess and alignment requirements into your protocol.