diff --git a/benchmarks/Benchmarks/HttpBenchmarks.cs b/benchmarks/Benchmarks/HttpBenchmarks.cs index 62ee8c7..2952d1c 100644 --- a/benchmarks/Benchmarks/HttpBenchmarks.cs +++ b/benchmarks/Benchmarks/HttpBenchmarks.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using HyperSharp.Protocol; +using HyperSharp.Results; using Microsoft.Extensions.DependencyInjection; namespace HyperSharp.Benchmarks.Cases @@ -27,10 +28,10 @@ public HttpBenchmarks() public void Setup() => _hyperServer.Start(); [GlobalCleanup] - public void Cleanup() => _hyperServer.Stop(); + public async Task CleanupAsync() => await _hyperServer.StopAsync(); [WarmupCount(5), Benchmark] - public async Task HttpClientTestAsync() => await _client.GetAsync("http://localhost:8080/"); + public Task HttpClientTestAsync() => _client.GetAsync("http://localhost:8080/"); [IterationSetup(Target = nameof(ParseHeadersTestAsync))] public void HeaderIterationSetup() @@ -40,7 +41,7 @@ public void HeaderIterationSetup() _connection = new(stream, _hyperServer); } - [Benchmark] - public async ValueTask ParseHeadersTestAsync() => await HyperHeaderParser.TryParseHeadersAsync(_hyperServer.Configuration.MaxHeaderSize, _connection, default); + [WarmupCount(5), Benchmark] + public ValueTask> ParseHeadersTestAsync() => HyperHeaderParser.TryParseHeadersAsync(_hyperServer.Configuration.MaxHeaderSize, _connection, default); } } diff --git a/benchmarks/Program.cs b/benchmarks/Program.cs index eb353a9..6adec41 100644 --- a/benchmarks/Program.cs +++ b/benchmarks/Program.cs @@ -26,12 +26,12 @@ namespace HyperSharp.Benchmarks { public sealed class Program { - public static void Main() + public static void Main(string[] args) { #if DEBUG - Summary[] summaries = BenchmarkRunner.Run(typeof(Program).Assembly, ManualConfig.CreateMinimumViable().WithOptions(ConfigOptions.DisableOptimizationsValidator).AddJob(Job.Dry)); + Summary[] summaries = BenchmarkRunner.Run(typeof(Program).Assembly, ManualConfig.CreateMinimumViable().WithOptions(ConfigOptions.DisableOptimizationsValidator).AddJob(Job.Dry), args); #else - Summary[] summaries = BenchmarkRunner.Run(typeof(Program).Assembly); + Summary[] summaries = BenchmarkRunner.Run(typeof(Program).Assembly, args: args); #endif Summary firstSummary = summaries[0]; File.WriteAllText("benchmark-results.md", string.Empty); diff --git a/tests/HyperSharp/ParseHeadersTest.cs b/tests/HyperSharp/ParseHeadersTest.cs index d6c39be..9f2bfac 100644 --- a/tests/HyperSharp/ParseHeadersTest.cs +++ b/tests/HyperSharp/ParseHeadersTest.cs @@ -107,17 +107,6 @@ public void TestNormalizeHeaderName() Assert.AreEqual("Content-Type", normalized); } - /// - /// Tests indexing a header name, which skips header name normalization. - /// - [TestMethod] - public void TestNormalizeHeaderNameIndex() - { - string originalName = "content-type"; - HyperHeaderCollection headerCollection = new() { { originalName, "application/json" } }; - Assert.ThrowsException(() => headerCollection[originalName]); - } - /// /// Tests validating a valid header. ///