Skip to content

Reduce allocations in MakeArrayFormatter #52675

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
Dec 11, 2023

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Dec 8, 2023

JsonEncodedText is a struct. Passing it into StringBuilder.Append will box the value into an object, just to call ToString() on it.

Instead, grab the Value string from the JsonEncodedText and pass the string into StringBuilder.Append, so nothing is boxed.

JsonEncodedText is a struct. Passing it into StringBuilder.Append will box the value into an object, just to call ToString() on it.

Instead, grab the Value string from the JsonEncodedText and pass the string into StringBuilder.Append, so nothing is boxed.
@eerhardt eerhardt requested a review from a team as a code owner December 8, 2023 21:40
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Dec 8, 2023
Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

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

Thanks!

@eerhardt eerhardt merged commit eaefe7a into dotnet:main Dec 11, 2023
@eerhardt eerhardt deleted the FixJsonEncodedTextUsage branch December 11, 2023 15:42
@ghost ghost added this to the 9.0-preview1 milestone Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants