Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Cache the ContentLength header value #296

Merged
merged 1 commit into from
Jan 24, 2017
Merged

Conversation

Tratcher
Copy link
Member

aspnet/HttpAbstractions#757
I've also removed an obsolete layer of abstraction around the headers (HeaderDictionary) as a result of the prior package merge.

@Tratcher Tratcher added this to the 2.0.0 milestone Jan 18, 2017
@Tratcher Tratcher self-assigned this Jan 18, 2017
@Tratcher Tratcher requested a review from JunTaoLuo January 18, 2017 23:40
Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests? And also, any indications on what the performance improvement is?

{
private long? _contentLength;
private StringValues _contentLengthText;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this is kept as a StringValues? We will only store it when its count is 1 so why not store the string instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check it against the raw header StringValues and this avoids the extra conversions

@Tratcher
Copy link
Member Author

There are quite a few tests for Content-Length already. I'll try some perf metrics today.

@Tratcher
Copy link
Member Author

Before: 100K requests in 28.05s
image

After: 100K requests in 27.43s
image

@Tratcher
Copy link
Member Author

It could use a targeted test around making sure the string and long stay in sync when the value is changed / removed.

@Tratcher Tratcher force-pushed the tratcher/contentlength branch from 91396d1 to 119945c Compare January 24, 2017 23:00
@Tratcher Tratcher merged commit 119945c into dev Jan 24, 2017
@Tratcher Tratcher deleted the tratcher/contentlength branch January 24, 2017 23:00
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.

2 participants