▲ | RainyDayTmrw 14 hours ago | ||||||||||||||||
That matches the advice from Latacora[1]. That advice makes a lot of sense from a security correctness and surface area perspective. There's a potential developer experience and efficiency concern, though. This likely forces two deserialization operations, and therefore two big memory copies, once for deserializing the envelope and once for deserializing the inner message. If we assume that most of the outer message is the inner message, and relatively little of it is the signature or MAC, then our extra memory copy is for almost the full length of the full message. | |||||||||||||||||
▲ | amluto 4 hours ago | parent [-] | ||||||||||||||||
There are a few serialization/deserialization systems that are close enough to zero-copy that this has no overhead. Cap’n Proto and FlatBuffers were designed around roughly this idea. Even some protobuf implementations allow in-place reads of bytes. | |||||||||||||||||
|