Skip to content

Optimize StringBuilder.Equals(ReadOnlySpan<char>) to compare by chunk#565

Merged
SimonCropp merged 1 commit into
mainfrom
Optimize-StringBuilder.Equals(ReadOnlySpan-char-)-to-compare-by-chunk
Jun 29, 2026
Merged

Optimize StringBuilder.Equals(ReadOnlySpan<char>) to compare by chunk#565
SimonCropp merged 1 commit into
mainfrom
Optimize-StringBuilder.Equals(ReadOnlySpan-char-)-to-compare-by-chunk

Conversation

@SimonCropp

Copy link
Copy Markdown
Owner

Walk the StringBuilder's contiguous chunks and compare each with the vectorized ReadOnlySpan.SequenceEqual, instead of indexing per char (the indexer walks the chunk list on every access). Add multi-chunk and mismatch test coverage.

Walk the StringBuilder's contiguous chunks and compare each with the
vectorized ReadOnlySpan.SequenceEqual, instead of indexing per char
(the indexer walks the chunk list on every access). Add multi-chunk
and mismatch test coverage.
@SimonCropp SimonCropp added this to the 10.11.1 milestone Jun 29, 2026
@SimonCropp SimonCropp merged commit fcde467 into main Jun 29, 2026
6 checks passed
@SimonCropp SimonCropp deleted the Optimize-StringBuilder.Equals(ReadOnlySpan-char-)-to-compare-by-chunk branch June 29, 2026 05:30
This was referenced Jun 30, 2026
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.

1 participant