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

Use StringBuilder.AppendInt() in more places to reduce allocations when appending integers to a StringBuilder #5662

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Mar 1, 2024

Bug

Fixes: NuGet/Home#13282

Regression? Last working version:

Description

StringBuilder.Append(int) allocates a string in order to append an integer so this code adds an extension method which uses chars instead to avoid allocating unnecessary strings.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception - Existing coverage
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@Erarndt Erarndt requested a review from a team as a code owner March 1, 2024 19:47
@jeffkl jeffkl self-assigned this Mar 1, 2024
@jeffkl jeffkl added Approved for CI Community PRs created by someone not in the NuGet team labels Mar 1, 2024
@jeffkl jeffkl changed the title Use AppendInt in more places Introduce StringBuilder.AppendInt() to reduce allocations when appending integers to a StringBuilder Mar 1, 2024
@jeffkl jeffkl changed the title Introduce StringBuilder.AppendInt() to reduce allocations when appending integers to a StringBuilder Use StringBuilder.AppendInt() in more places to reduce allocations when appending integers to a StringBuilder Mar 1, 2024
@jeffkl jeffkl merged commit 7fa8340 into NuGet:dev Mar 4, 2024
16 checks passed
@Erarndt Erarndt deleted the dev-erarndt-appendInt branch March 4, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
2 participants