Low hanging allocation fruit (#9796)
- We were allocating a Task<int> for every read, return a ValueTask<int> for the cases where reads complete synchronously.
This commit is contained in:
parent
e22702891d
commit
cc8af6d2c4
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core
|
||||||
/// <param name="memory"></param>
|
/// <param name="memory"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal async Task<int> ReadAsync(Memory<byte> memory, CancellationToken cancellationToken)
|
internal async ValueTask<int> ReadAsync(Memory<byte> memory, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!_hasRequestReadingStarted)
|
if (!_hasRequestReadingStarted)
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
flush = flush | result.IsCanceled;
|
flush |= result.IsCanceled;
|
||||||
|
|
||||||
if (flush)
|
if (flush)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue