-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
Milestone
Description
this was noticed while working on #57079
There are few places when we allocate when we may not need to - particularly converting ALPN list to array.
The list is typically small so we may use stackalloc.
Further more, typical use would probably have only http11 and h2. We can probably special-case this and avoid processing for each connection. HttpClient already does that:
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Lines 298 to 300 in 999e412
| private static readonly List<SslApplicationProtocol> s_http3ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http3 }; | |
| private static readonly List<SslApplicationProtocol> s_http2ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 }; | |
| private static readonly List<SslApplicationProtocol> s_http2OnlyApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2 }; |