Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Reduce collection wrapping #426

Closed
Tratcher opened this issue Oct 1, 2015 · 3 comments
Closed

Reduce collection wrapping #426

Tratcher opened this issue Oct 1, 2015 · 3 comments
Assignees
Milestone

Comments

@Tratcher
Copy link
Member

Tratcher commented Oct 1, 2015

There are several cases where low level APIs produce a basic IDictionary or similar, but then we wrap it in a IFoo : IDictionary to make it more user friendly. These wrappers cause lots of extra allocations on each request, resulting in lots of GCs. The main culperates are request headers, response headers, query, form, and cookies.

Headers we can fix by moving IHeaderDictionary into the Features package, use it for IHttpRequestFeature.Headers & IHttpResponseFeature.Headers, and have the servers implement it directly. This is a little more work for the servers, but it removes a wrapper layer. We'll still need the old wrapper implementation for tests though.

Query, Form, and Cookies we can address by having the callers create a collection that implements IDictionary and their own interface (IQueryCollection, IFormCollection, and ICookiesCollection), and having the parser add everything to the provided IDictionary.

@benaadams
Copy link
Contributor

Quick check on "why" the additional interfaces; is this because it is a different contract?

@benaadams
Copy link
Contributor

As in context exposes via new interfaces

@muratg muratg modified the milestones: 1.0.0-rc2, 1.0.0-rc1 Oct 22, 2015
@Tratcher
Copy link
Member Author

#411

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants