Skip to content

reduce ToCamelCase allocations by using string.Create#361

Merged
SimonCropp merged 2 commits into
mainfrom
reduce-ToCamelCase-allocations-by-using-string.Create
May 18, 2026
Merged

reduce ToCamelCase allocations by using string.Create#361
SimonCropp merged 2 commits into
mainfrom
reduce-ToCamelCase-allocations-by-using-string.Create

Conversation

@SimonCropp
Copy link
Copy Markdown
Member

Replaces ToCharArray() + new string(chars) with string.Create, which
writes directly into the new string's buffer. Halves allocations
(1.37 KB → 688 B) and runs ~37% faster on a 15-name workload.

  Replaces ToCharArray() + new string(chars) with string.Create, which
  writes directly into the new string's buffer. Halves allocations
  (1.37 KB → 688 B) and runs ~37% faster on a 15-name workload.
…locations-by-using-string.Create

# Conflicts:
#	src/Benchmark.Tests/Program.cs
@SimonCropp SimonCropp merged commit 0af69e0 into main May 18, 2026
4 checks passed
@SimonCropp SimonCropp deleted the reduce-ToCamelCase-allocations-by-using-string.Create branch May 18, 2026 11:53
@SimonCropp SimonCropp added this to the 0.34.0 milestone May 18, 2026
This was referenced May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant