Skip to content

Avoid string allocation when converting zero #19732

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

Merged
merged 1 commit into from
Mar 11, 2020

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 10, 2020

Fixes #19731

@@ -562,6 +562,11 @@ public unsafe static string FormatNonNegativeInt64(long value)
throw new ArgumentOutOfRangeException(nameof(value), value, "The value to be formatted must be non-negative.");
}

if (value == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Certified Z E S T Y

Copy link
Member Author

Choose a reason for hiding this comment

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

If it is stupid and it works, is it really stupid? 🐴

Copy link
Contributor

Choose a reason for hiding this comment

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

𝓟𝓻𝓸𝓯𝓸𝓾𝓷𝓭

@analogrelay analogrelay added this to the 5.0.0-preview3 milestone Mar 10, 2020
@JamesNK JamesNK merged commit 56a64a6 into master Mar 11, 2020
@JamesNK JamesNK deleted the jamesnk/contentlength-optimize branch March 11, 2020 20:52
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP2: content-length header string allocation
5 participants