Skip to content

Remove calls to ToArray because string.Join already has overload for ROS<string>.#124792

Merged
cincuranet merged 1 commit intodotnet:mainfrom
cincuranet:remove-toarray
Feb 25, 2026
Merged

Remove calls to ToArray because string.Join already has overload for ROS<string>.#124792
cincuranet merged 1 commit intodotnet:mainfrom
cincuranet:remove-toarray

Conversation

@cincuranet
Copy link
Contributor

No description provided.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

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 optimizes string concatenation in logging code by removing unnecessary .ToArray() calls when using string.Join() with ReadOnlySpan<string> parameters. The string.Join method has overloads that accept ReadOnlySpan<string?> directly, making the array allocation unnecessary and improving performance.

Changes:

  • Removed .ToArray() calls in two logging statements within Http2Connection.cs
  • Reduced allocations in diagnostic/tracing code paths that are conditionally enabled

@stephentoub stephentoub marked this pull request as ready for review February 24, 2026 13:51
@stephentoub stephentoub changed the title Remove calls to ToArray because string.Join already has overload for OS<string>. Remove calls to ToArray because string.Join already has overload for ROS<string>. Feb 24, 2026
@cincuranet
Copy link
Contributor Author

/ba-g Failures are unrelated.

@cincuranet cincuranet merged commit 33e63ad into dotnet:main Feb 25, 2026
89 of 94 checks passed
@cincuranet cincuranet deleted the remove-toarray branch February 25, 2026 08:17
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants