At the moment, when serializing A.b, a separate buffer is allocated to store the bytes of B, and then it is copied to the byte buffer of A. It should be possible to pre-allocate a bigger buffer when serializing A that is passed to the serialization func of B, to avoid unnecessary alloc and copying.
Consider the following two messages:
At the moment, when serializing
A.b
, a separate buffer is allocated to store the bytes ofB
, and then it is copied to the byte buffer ofA
. It should be possible to pre-allocate a bigger buffer when serializing A that is passed to the serialization func of B, to avoid unnecessary alloc and copying.