Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringValues.Count test null first #52508

Merged

Conversation

benaadams
Copy link
Member

Trying to cast is string and then doing a is null later is inefficent when in practice a lot of the values are default(StringValues); so it should do the cheap null test first before the cast

@ghost
Copy link

ghost commented May 8, 2021

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Trying to cast is string and then doing a is null later is inefficent when in practice a lot of the values are default(StringValues); so it should do the cheap null test first before the cast

Author: benaadams
Assignees: -
Labels:

area-Extensions-Primitives

Milestone: -

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM, as long as:

when in practice a lot of the values are default(StringValues)

is true more times than StringValues represents a single string.

@benaadams
Copy link
Member Author

is true more times than StringValues represents a single string.

If header is not set IHeaderDictionary returns default and out of the range of possible headers they are usualyl not set

@maryamariyan maryamariyan merged commit 8b4684e into dotnet:main May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants