[http] Simplify H1 codec by removing the reserve/commit pattern #9825
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This simplifies the H/1 codec by removing the pre-buffer reserved_iovec_ in the HTTP1 codec.
This change reduces effective memory usage by removing the need to round up when reserving memory blocks in OwnedImpl::reserve. The
output_buffer_
in the codec is a watermark buffer that on adds willcheckHighWatermark
. Performance may suffer slightly due to an increase in number of calls tocheckHighWatermark
while serializing headers.(Before the change, watermarks were checked at most twice in ConnectionImpl::reserveBuffer (commit if needed and reserve), and not in the following calls to add/copy to the buffer. Now, add/copyToBuffer directly call the watermark buffer, so check watermarks are increased.)
Risk level: medium/high
Testing: existing tests pass (suggestions welcome for more if I can peak at the connection's buffer)
Signed-off-by: Asra Ali [email protected]