Skip to content

Avoid array allocations when evaluating connections for eviction#131142

Merged
MihaZupan merged 1 commit into
dotnet:mainfrom
MihaZupan:http-connectionEvictionFollowup
Jul 21, 2026
Merged

Avoid array allocations when evaluating connections for eviction#131142
MihaZupan merged 1 commit into
dotnet:mainfrom
MihaZupan:http-connectionEvictionFollowup

Conversation

@MihaZupan

Copy link
Copy Markdown
Member

Just a small perf improvement follow-up to #130476 (didn't want to re-run CI there)

@MihaZupan MihaZupan added this to the 11.0.0 milestone Jul 21, 2026
@MihaZupan MihaZupan self-assigned this Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 11:43
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 attempts to reduce allocations in SocketsHttpHandler connection eviction evaluation by avoiding List<T>.ToArray() when iterating available HTTP/2 and HTTP/3 connections in HttpConnectionPool.

Changes:

  • Replace array snapshots (ToArray()) with CollectionsMarshal.AsSpan() for available HTTP/2 connections.
  • Do the same for available HTTP/3 connections when HTTP/3 is enabled.
  • Add System.Runtime.InteropServices for CollectionsMarshal.

@MihaZupan
MihaZupan enabled auto-merge (squash) July 21, 2026 11:49
@MihaZupan
MihaZupan merged commit 163b357 into dotnet:main Jul 21, 2026
93 checks passed
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.

3 participants