Skip to content

SslStream doesn't amortize its ValueTask ReadAsync calls #30168

@benaadams

Description

@benaadams

In usage a SslStream normally has very many ReadAsync calls made on it. (Use case WebSockets/SignalR over TLS)

Using the ValueTask overloads for SslStream read allocates 2x AsyncStateMachineBox per read (when data is not immediately available)

image

However it could allocate once; backing with an IValueTaskSource objects that get allocated for the first async and reused when the read goes async again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions