-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue
Milestone
Description
Currently, the HeaderDescriptor struct has two fields:
private readonly string _headerName;
private readonly KnownHeader? _knownHeader;A HeaderDescriptor is either:
(1) a known header, in which case KnownHeader is not null and _headerName is equal to _knownHeader.Name; or
(2) a custom header, in which case KnownHeader is null
We use HeaderDescriptor as the key for the HttpHeader header dictionary, which means we end up having a lot of instances of this structure.
We could optimize for memory here by combining these two fields into a single object field that contains either a string or a KnownHeader, and then do type casts. This would result in a small amount of additional CPU work to do the casts, but this may be worth the memory savings.
MihaZupan
Metadata
Metadata
Assignees
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issuePerformance related issue