Add RawSpan APIs to the ResponseSender - #124
Conversation
| var byteBuffer = ByteBuffer() | ||
| byteBuffer.reserveCapacity(bytes.byteCount) | ||
| byteBuffer.writeBytes(bytes) |
There was a problem hiding this comment.
The byte buffer allocation here makes this path really sad.
There was a problem hiding this comment.
It needs to be copied into a ByteBuffer at some point because that's what the channel handler takes. The HTTP server needs to own the data because of the difference of when NIO returns and when the data actually hits the socket (IIRC this is a documented part of the channel handler). This APIs here at least stops you going from Data/Array/ByteBuffer/whatever type you want, into a unique array back into ByteBuffer in the channel handler
There was a problem hiding this comment.
The only reason we need this API is because ByteBuffer does not conform to RangeReplacableContainer nor do the span types.
There was a problem hiding this comment.
We'd still have a copy somewhere, unless it was ByteBuffer through the whole stack right? (Assuming RangeReplaceableContainer). Because that's what NIO talks in the channel handler/socket so it needs a copy to convert it in. I don't think ByteBuffer has any mechanism to borrow yet
Resolves #123