Details
-
Enhancement
-
Resolution: Won't Do
-
Major
-
None
-
4.4.1.Final
-
None
Description
When writing a wrapped nested message, WrappedMessage.writeMessage() allocates a new ByteArrayOutputStreamEx to store the output of the nested message (starting with byte[32] and growing as needed), but also a OutputStreamEncoder with an internal byte[4096] fixed buffer.
GeneratedMarshallerBase#writeNestedMessage() allocates a similar byte[4096] buffer every time it writes a non-wrapped nested message.
It should be easy to reuse the fixed buffer from the parent OutputStreamEncoder in both situations and avoid an allocation.
Avoiding the allocation of the ByteArrayOutputStreamEx is much harder, but it should be possible to modify ByteArrayOutputStreamEx so that it doesn't allocate anything until the first write operation, thus avoiding the byte[32] allocation in the (common, I assume) case where the output is larger than 32 bytes.
Attachments
Issue Links
- is related to
-
IPROTO-228 Remove temporary buffers when marshalling objects
- Resolved