29 Jun
2026
29 Jun
'26
11:44 p.m.
Ruben Perez wrote:
My use case (length-prefixed message protocols) looks like a good use case for capy::read (plain buffer version). Actually, the reference section lists this use case as example [18]. I'm not sure this pattern is efficient, though, as with most streams in Corosio you'd be running two syscalls per message. As an improvement, I could implement a wrapper stream that buffers bytes (à la Asio's buffered_stream [19]), but manual handling looks simpler to me.
Buffered streams are absolutely essential for performance when serializing or deserializing (e.g. over binary protocols), see https://github.com/pdimov/corosio_protocol_bench