Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

perf: remove unnecessary manual string.Replace code. - #4134

#4134
Merged
thomhurst merged 1 commit into
thomhurst:mainthomhurst/TUnit:mainfrom
TimothyMakkison:string_replaceTimothyMakkison/TUnit:string_replaceCopy head branch name to clipboard
Dec 22, 2025
Merged

perf: remove unnecessary manual string.Replace code.#4134
thomhurst merged 1 commit into
thomhurst:mainthomhurst/TUnit:mainfrom
TimothyMakkison:string_replaceTimothyMakkison/TUnit:string_replaceCopy head branch name to clipboard

Conversation

@TimothyMakkison

@TimothyMakkison TimothyMakkison commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

Remove redundant manual string.Replace code. string.Replace is almost certainly faster, doesn't allocate when there aren't any changes to the string, uses string.Create, uses Vectorised lookups to find targets and won't allocate an intermediary buffer when the input string is larger than 256 characters.

Contains call isn't needed because string.Replace does the same thing and early returns with the original string.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes a manual span-based string manipulation implementation in favor of using the built-in string.Replace method. The change simplifies code in ArgumentFormatter.FormatDefault where dots are replaced with middle dots (·) to prevent VS Test Explorer from misinterpreting them as namespace separators.

Key Changes:

  • Removes the #if NET8_0_OR_GREATER conditional compilation block with manual Span<char> manipulation
  • Replaces it with a simple str.Replace(".", "·") call that works across all target frameworks
  • Maintains the existing optimization that skips replacement when no dots are present

@thomhurst

Copy link
Copy Markdown
Owner

Thanks!

This was referenced Feb 2, 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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.