From cc8af6d2c40af72b1d2e689f994eb5dfdc9e2940 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sun, 28 Apr 2019 19:02:01 -0700 Subject: [PATCH] Low hanging allocation fruit (#9796) - We were allocating a Task for every read, return a ValueTask for the cases where reads complete synchronously. --- src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs b/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs index 9b6fecd000..feea13e2e2 100644 --- a/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs +++ b/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core /// /// /// - internal async Task ReadAsync(Memory memory, CancellationToken cancellationToken) + internal async ValueTask ReadAsync(Memory memory, CancellationToken cancellationToken) { if (!_hasRequestReadingStarted) { @@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core break; } - flush = flush | result.IsCanceled; + flush |= result.IsCanceled; if (flush) {