Closed
Description
Is your feature request related to a problem? Please describe.
For each request from the browser a lot of repeated headers are sent that are identical to the previous request.
This results in a lot of string allocations, especially for Accept
, Cookie
and User-Agent
e.g.
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Cookie: (**redacted up to 2KB of data**)
Host: github.com
Pragma: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
Describe the solution you'd like
The previous request has already materialized these values as strings, so they could be reused rather than allocating new strings.
Additional context
Tracking issue
In March 5th, 2019's ASP.NET Community Standup, @DamianEdwards expressed that he thought this was already happening; then continued to suggest that in a future version it would be important to continue to reduce memory used for headers.
/cc @davidfowl