-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 0.0.6
-
Component/s: Connections
Currently when we attempt to read a wire message from a connection.Connection the c.readBuf will either be the correct size already or it will be shrunk. If either of these cannot be done, then a new buffer is allocated. This wastes allocation because the buffer that was allocated could have a capacity that is of the correct size, meaning that we only actually need to allocate a buffer if the message we are going to read is larger than the largest message we've ever read.
Update the ReadWireMessage method of the connection.Connection type to check the capacity of the readBuf and if the capacity is large enough, reslice the slice to that size.