KEMBAR78
Improve efficiency of parsing of Transfer-Encoding: chunked on HTTP/1.1 response · Issue #63052 · dotnet/runtime · GitHub
Skip to content

Improve efficiency of parsing of Transfer-Encoding: chunked on HTTP/1.1 response #63052

@geoffkizer

Description

@geoffkizer

We need to check for Transfer-Encoding: chunked on every HTTP/1.1 response.

This results in a call to HttpHeaders.ContainsParsedValue, which forces parsing of the Transfer-Encoding header (if present) into TransferCodingHeaderValue instances.

We can avoid allocating TransferCodingHeaderValue instances here by special casing the Transfer-Encoding parsing in this case and specifically looking only for the "chunked" value.

Note: There are probably similar issues with other response headers where we can avoid unnecessary overhead. I believe we have an issue where accessing Content-Length forces the Content-Length value to be boxed in the header store, which we could avoid. We should look at Connection: close as well. We may also have other similar issues on the request side for critical headers like Transfer-Encoding: chunked, Content-Length, Connection: close, Expect: 100-continue, Host, etc. Some of these apply to HTTP2/3 as well. We should investigate these and file issues as needed.

Metadata

Metadata

Assignees

Labels

area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions