Skip to content

HttpRequestStream & DuplexPipeStream don't amortize their ValueTask ReadAsync calls  #11940

Open
@benaadams

Description

@benaadams

In usage a HttpRequestStream & DuplexPipeStream normally has very many ReadAsync calls made on them. (Use case WebSockets/SignalR over TLS)

Using the ValueTask overloads for these Streams read allocates a AsyncStateMachineBox per read (when data is not immediately available)

image

However it could use TryRead for the sync-path and allocating a IValueTaskSource object the first time that fails to back the async read, and then reuse it each time the read needs to go async again.

Related https://github.com/dotnet/corefx/issues/39258

Metadata

Metadata

Assignees

No one assigned

    Labels

    Perfaffected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneseverity-nice-to-haveThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions