This byte[] allocation for a nested message
|
messageBytes = in.readByteArray(); |
can use a ByteBuffer instead which should provide a constant allocation cost instead of a possibly very large byte[] if the nested message is bigger, which can very easily with any user key or value object references.