Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Fast-path header dictionaries#1007

Closed
benaadams wants to merge 3 commits intoaspnet:devfrom
benaadams:order-headers
Closed

Fast-path header dictionaries#1007
benaadams wants to merge 3 commits intoaspnet:devfrom
benaadams:order-headers

Conversation

@benaadams
Copy link
Contributor

@benaadams benaadams commented Jul 21, 2016

Reopened allocs as #1009

Don't allocate a key string (which then isn't used) for known keys. (Cuts out 42% of string allocations)

Before
unnecessary-allocations
After
removed-unnecessary-allocations
String allocs are now only x4 higher than other things
total-allocations

Currently the header dictionary is randomly? ordered. This moves things around so some items are in a particular order:

  • Host first in FrameRequestHeaders' Append/AppendValueFast/SetValueFast
  • Content-Length, Content-Type first in FrameResponseHeaders' AppendValueFast/SetValueFast

Enumerator and CopyToFast in FrameResponseHeaders bail if nothing after: Connection, Date, Server, Content-Length, Transfer-Encoding (for MVC), Content-Type headers - rather than running through the full list of headers.

Full order probably needs work on the rest with frequency analysis.

@nathana1 @halter73 @CesarBS how does this compare to #829 ?

ReponseCookiesFeature and FormFeature moved to delayed allocation in aspnet/HttpAbstractions#675

@benaadams benaadams force-pushed the order-headers branch 2 times, most recently from a9aea50 to bd0fdb8 Compare July 22, 2016 00:08
@benaadams benaadams changed the title Order header dictionaries Fast-path header dictionaries Jul 22, 2016
@halter73
Copy link
Member

The first commit seems like an obvious win. Nice catch.

The rest is a little complicated/questionable without benchmarks for the reordering changes specifically showing a nice improvement. I think we're just going to merge the first commit and close the rest.

Currently the header dictionary is randomly? ordered. This adds a first
pass on an order
@benaadams
Copy link
Contributor Author

benaadams commented Jul 22, 2016

@halter73 I think you might be right; looking a dubious difference for request; will close to eval response.

Opened allocs as #1009

@benaadams benaadams closed this Jul 22, 2016
@benaadams benaadams deleted the order-headers branch March 27, 2018 05:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants