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

Reduce delegate allocation #321

Merged
merged 1 commit into from
Nov 4, 2015
Merged

Reduce delegate allocation #321

merged 1 commit into from
Nov 4, 2015

Conversation

benaadams
Copy link
Contributor

No description provided.

@khellang
Copy link
Contributor

khellang commented Nov 1, 2015

@benaadams You're on a roll! Seen this? dotnet/roslyn#5835

@benaadams
Copy link
Contributor Author

@khellang Soon; hopefully, but not yet... :(

@@ -94,7 +94,7 @@ public static bool TryGet(IDictionary<string, StringValues> headers, string name
value = values[0];
return true;
}
value = String.Join(",", values);
value = string.Join(",", values.ToArray());
Copy link
Member

Choose a reason for hiding this comment

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

Before this change wasn't this overload of string.Join being used? Is there a reason to avoid that overload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, boxes enumerator to IEnumerator; as items > 1 we know .ToArray will return an underlying array without creation.

@halter73 halter73 merged commit d104e8a into aspnet:dev Nov 4, 2015
@benaadams benaadams deleted the delegates branch November 6, 2015 07:30
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.

4 participants