From 7ab44423920eb57f48ef1aff09d8dd7f8b8e1270 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 18 Nov 2016 23:30:12 +0000 Subject: [PATCH] Feedback + Cleanup --- .../Program.cs | 2 -- .../configs/CoreConfig.cs | 4 ---- .../configs/DefaultConfig.cs | 4 ---- .../helpers/MockKestrelTrace.cs | 3 --- .../Internal/Infrastructure/Constants.cs | 3 +++ .../Internal/Infrastructure/MemoryPoolIterator.cs | 5 ++--- .../Internal/Infrastructure/MemoryPoolIteratorExtensions.cs | 3 --- 7 files changed, 5 insertions(+), 19 deletions(-) diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs index db29b584db..688771f622 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs +++ b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/Program.cs @@ -43,6 +43,4 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance All = uint.MaxValue } - - } diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs index eff6663fec..72056a28b4 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs +++ b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/CoreConfig.cs @@ -3,7 +3,6 @@ using BenchmarkDotNet.Configs; using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Validators; @@ -17,10 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance Add(new RpsColumn()); Add(Job.Default. - With(Platform.X64). - With(Jit.RyuJit). With(BenchmarkDotNet.Environments.Runtime.Core). - WithRemoveOutliers(true). With(new GcMode() { Server = true }). With(RunStrategy.Throughput). WithLaunchCount(3). diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs index 01f30373c4..6b2670302c 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs +++ b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/configs/DefaultConfig.cs @@ -20,7 +20,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance With(Platform.X64). With(Jit.RyuJit). With(BenchmarkDotNet.Environments.Runtime.Clr). - WithRemoveOutliers(true). With(new GcMode() { Server = true }). With(RunStrategy.Throughput). WithLaunchCount(3). @@ -28,10 +27,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance WithTargetCount(10)); Add(Job.Default. - With(Platform.X64). - With(Jit.RyuJit). With(BenchmarkDotNet.Environments.Runtime.Core). - WithRemoveOutliers(true). With(new GcMode() { Server = true }). With(RunStrategy.Throughput). WithLaunchCount(3). diff --git a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs index 9e035010d3..5d5bf38201 100644 --- a/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs +++ b/perf/Microsoft.AspNetCore.Server.Kestrel.Performance/helpers/MockKestrelTrace.cs @@ -20,17 +20,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance public override void ConnectionRead(string connectionId, int count) { - //_logger.LogDebug(1, @"Connection id ""{ConnectionId}"" recv {count} bytes.", connectionId, count); } public override void ConnectionWrite(string connectionId, int count) { - //_logger.LogDebug(1, @"Connection id ""{ConnectionId}"" send {count} bytes.", connectionId, count); } public override void ConnectionWriteCallback(string connectionId, int status) { - //_logger.LogDebug(1, @"Connection id ""{ConnectionId}"" send finished with status {status}.", connectionId, status); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/Constants.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/Constants.cs index 77968bca17..32267912e0 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/Constants.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/Constants.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.InteropServices; +using System.Text; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure { @@ -13,6 +14,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure public static readonly int? ECONNRESET = GetECONNRESET(); public static readonly int? EADDRINUSE = GetEADDRINUSE(); + public static readonly Encoding UTF8 = Encoding.UTF8; + /// /// Prefix of host name used to specify Unix sockets in the configuration. /// diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs index f562c9ae02..9f18b75465 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIterator.cs @@ -21,7 +21,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure 0x02ul << 40 | 0x01ul << 48 ) + 1; - private static readonly Encoding _utf8 = Encoding.UTF8; private static readonly int _vectorSpan = Vector.Count; private MemoryPoolBlock _block; @@ -1124,10 +1123,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure } if (end.Block == Block) { - return _utf8.GetString(Block.Array, Index, end.Index - Index); + return Constants.UTF8.GetString(Block.Array, Index, end.Index - Index); } - var decoder = _utf8.GetDecoder(); + var decoder = Constants.UTF8.GetDecoder(); var length = GetLength(end); var charLength = length; diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs index 0b7e988af3..1839d3309f 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs @@ -6,14 +6,11 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using System.Text; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Server.Kestrel.Internal.Http; namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure { public static class MemoryPoolIteratorExtensions { - private static readonly Encoding _utf8 = Encoding.UTF8; - public const string Http10Version = "HTTP/1.0"; public const string Http11Version = "HTTP/1.1";