You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MCRequest.Receive, a new buffer is allocated for every receive for the body of the request:
buf := make([]byte, klen+elen+bodyLen)
It would be great if this function could instead accept a buffer as an argument so that buffers could be re-used across requests. The code could use cap(buf) to ensure that the buffer is long enough, and buf = buf[:klen+elen+bodyLen] to limit its length. Only if it buf is too small should it allocate its own (and potentially warn the caller that the buffer was not used).
The text was updated successfully, but these errors were encountered:
In
MCRequest.Receive
, a new buffer is allocated for every receive for the body of the request:It would be great if this function could instead accept a buffer as an argument so that buffers could be re-used across requests. The code could use
cap(buf)
to ensure that the buffer is long enough, andbuf = buf[:klen+elen+bodyLen]
to limit its length. Only if it buf is too small should it allocate its own (and potentially warn the caller that the buffer was not used).The text was updated successfully, but these errors were encountered: