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

perf: add ValueStringBuilder #1513

Closed
wants to merge 2 commits into from

Conversation

TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Feb 26, 2025

Add ValueStringBuilder to replace the StringBuilder allocation in SeparatedSyntaxList.Print saves 0.5MB

  • Uses MemoryExtensions.Trim to avoid allocating an extra string
    • .NET Standard 2.0 doesn't have this method. I opted to add a simple allocating version as I assume .NET Standard performance doesn't matter as much.
    • I can copy over the relevant performance code for .NET Standard if you'd prefer
  • Uses SkipLocalsInit to get around the minor zeroing cost during prolog, this isn't essential

Do you think this PRs complexity is worth adding it's not a massive saving.

@belav
Copy link
Owner

belav commented Mar 1, 2025

If the only benefit is 0.5MB I don't think it would be worth the added complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants