Browse Source

Update to .NET 7 (#7698)

* Update to .NET 7

* Apply suggestions from code review

Co-authored-by: Eric Erhardt <[email protected]>

* Feedback

* Seal classes

* Add PublishAot configurations

* Remove corert

* Apply suggestions from code review

Co-authored-by: Damian Edwards <[email protected]>

Co-authored-by: Eric Erhardt <[email protected]>
Co-authored-by: Michal Strehovský <[email protected]>
Co-authored-by: Damian Edwards <[email protected]>
Ben Adams 2 years ago
parent
commit
607afc392b
82 changed files with 252 additions and 2469 deletions
  1. 0 38
      frameworks/CSharp/aspnetcore-corert/.gitignore
  2. 0 57
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/AsciiString.cs
  3. 0 19
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Caching.cs
  4. 0 57
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Fortunes.cs
  5. 0 295
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs
  6. 0 34
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Json.cs
  7. 0 46
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.MultipleQueries.cs
  8. 0 24
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Plaintext.cs
  9. 0 45
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.SingleQuery.cs
  10. 0 45
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Updates.cs
  11. 0 197
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.cs
  12. 0 58
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs
  13. 0 62
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferExtensions.cs
  14. 0 141
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferWriter.cs
  15. 0 11
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Configuration/AppSettings.cs
  16. 0 12
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Configuration/DatabaseServer.cs
  17. 0 41
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/BatchUpdateString.cs
  18. 0 13
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/CachedWorld.cs
  19. 0 22
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Fortune.cs
  20. 0 9
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/JsonMessage.cs
  21. 0 272
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs
  22. 0 265
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs
  23. 0 29
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Random.cs
  24. 0 14
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/World.cs
  25. 0 65
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/DateHeader.cs
  26. 0 28
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/HttpApplication.cs
  27. 0 14
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/IHttpConnection.cs
  28. 0 8
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/NuGet.Config
  29. 0 40
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/PlatformBenchmarks.csproj
  30. 0 90
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Program.cs
  31. 0 11
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Startup.cs
  32. 0 57
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/StringBuilderCache.cs
  33. 0 3
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.json
  34. 0 4
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.mysql.json
  35. 0 4
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.postgresql.json
  36. 0 4
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.postgresql.updates.json
  37. 0 28
      frameworks/CSharp/aspnetcore-corert/README.md
  38. 0 16
      frameworks/CSharp/aspnetcore-corert/aspcore-corert.dockerfile
  39. 0 63
      frameworks/CSharp/aspnetcore-corert/benchmark_config.json
  40. 0 42
      frameworks/CSharp/aspnetcore-corert/config.toml
  41. 5 4
      frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj
  42. 0 57
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/AsciiString.cs
  43. 5 5
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Fortunes.cs
  44. 5 5
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Json.cs
  45. 5 5
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Plaintext.cs
  46. 39 40
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs
  47. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/BatchUpdateString.cs
  48. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/CachedWorld.cs
  49. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs
  50. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs
  51. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Random.cs
  52. 2 4
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/DateHeader.cs
  53. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/HttpApplication.cs
  54. 9 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/PlatformBenchmarks.csproj
  55. 9 8
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Program.cs
  56. 1 1
      frameworks/CSharp/aspnetcore/PlatformBenchmarks/Startup.cs
  57. 2 2
      frameworks/CSharp/aspnetcore/aspcore-ado-my.dockerfile
  58. 2 2
      frameworks/CSharp/aspnetcore/aspcore-ado-pg-up.dockerfile
  59. 2 2
      frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile
  60. 4 4
      frameworks/CSharp/aspnetcore/aspcore-aot-ado-pg-up.dockerfile
  61. 4 4
      frameworks/CSharp/aspnetcore/aspcore-aot-ado-pg.dockerfile
  62. 18 0
      frameworks/CSharp/aspnetcore/aspcore-aot.dockerfile
  63. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-my.dockerfile
  64. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg-up.dockerfile
  65. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg.dockerfile
  66. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-my.dockerfile
  67. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg-up.dockerfile
  68. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg.dockerfile
  69. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc-ef-pg.dockerfile
  70. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mvc.dockerfile
  71. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-my.dockerfile
  72. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg-up.dockerfile
  73. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg.dockerfile
  74. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-my.dockerfile
  75. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg-up.dockerfile
  76. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg.dockerfile
  77. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-ef-pg.dockerfile
  78. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw-json.dockerfile
  79. 2 2
      frameworks/CSharp/aspnetcore/aspcore-mw.dockerfile
  80. 2 2
      frameworks/CSharp/aspnetcore/aspcore.dockerfile
  81. 58 0
      frameworks/CSharp/aspnetcore/benchmark_config.json
  82. 40 0
      frameworks/CSharp/aspnetcore/config.toml

+ 0 - 38
frameworks/CSharp/aspnetcore-corert/.gitignore

@@ -1,38 +0,0 @@
-[Oo]bj/
-[Bb]in/
-[Oo]ut/
-TestResults/
-.nuget/
-*.sln.ide/
-_ReSharper.*/
-.idea/
-packages/
-artifacts/
-PublishProfiles/
-.vs/
-*.user
-*.suo
-*.cache
-*.docstates
-_ReSharper.*
-nuget.exe
-*net45.csproj
-*net451.csproj
-*k10.csproj
-*.psess
-*.vsp
-*.pidb
-*.userprefs
-*DS_Store
-*.ncrunchsolution
-*.*sdf
-*.ipch
-*.swp
-*~
-.build/
-.testPublish/
-launchSettings.json
-BenchmarkDotNet.Artifacts/
-BDN.Generated/
-binaries/
-global.json

+ 0 - 57
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/AsciiString.cs

@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Text;
-
-namespace PlatformBenchmarks;
-
-public readonly struct AsciiString : IEquatable<AsciiString>
-{
-    private readonly byte[] _data;
-
-    public AsciiString(string s) => _data = Encoding.ASCII.GetBytes(s);
-
-    private AsciiString(byte[] b) => _data = b;
-
-    public int Length => _data.Length;
-
-    public ReadOnlySpan<byte> AsSpan() => _data;
-
-    public static implicit operator ReadOnlySpan<byte>(AsciiString str) => str._data;
-    public static implicit operator byte[](AsciiString str) => str._data;
-
-    public static implicit operator AsciiString(string str) => new(str);
-
-    public override string ToString() => Encoding.ASCII.GetString(_data);
-    public static explicit operator string(AsciiString str) => str.ToString();
-
-    public bool Equals(AsciiString other) => ReferenceEquals(_data, other._data) || SequenceEqual(_data, other._data);
-    private bool SequenceEqual(byte[] data1, byte[] data2) => new Span<byte>(data1).SequenceEqual(data2);
-
-    public static bool operator ==(AsciiString a, AsciiString b) => a.Equals(b);
-    public static bool operator !=(AsciiString a, AsciiString b) => !a.Equals(b);
-    public override bool Equals(object other) => (other is AsciiString @string) && Equals(@string);
-
-    public static AsciiString operator +(AsciiString a, AsciiString b)
-    {
-        var result = new byte[a.Length + b.Length];
-        a._data.CopyTo(result, 0);
-        b._data.CopyTo(result, a.Length);
-        return new AsciiString(result);
-    }
-
-    public override int GetHashCode()
-    {
-        // Copied from x64 version of string.GetLegacyNonRandomizedHashCode()
-        // https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/String.Comparison.cs
-        var data = _data;
-        int hash1 = 5381;
-        int hash2 = hash1;
-        foreach (int b in data)
-        {
-            hash1 = ((hash1 << 5) + hash1) ^ b;
-        }
-        return hash1 + (hash2 * 1566083941);
-    }
-
-}

+ 0 - 19
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Caching.cs

@@ -1,19 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if DATABASE
-
-using System.IO.Pipelines;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks;
-
-public partial class BenchmarkApplication
-{
-    private async Task Caching(PipeWriter pipeWriter, int count)
-    {
-        OutputMultipleQueries(pipeWriter, await Db.LoadCachedQueries(count), SerializerContext.CachedWorldArray);
-    }
-}
-
-#endif

+ 0 - 57
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Fortunes.cs

@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if DATABASE
-
-using System.Collections.Generic;
-using System.IO.Pipelines;
-using System.Text.Encodings.Web;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks
-{
-    public partial class BenchmarkApplication
-    {
-        private readonly static AsciiString _fortunesPreamble =
-            _http11OK +
-            _headerServer + _crlf +
-            _headerContentTypeHtml + _crlf +
-            _headerContentLength;
-
-        private async Task Fortunes(PipeWriter pipeWriter)
-        {
-            OutputFortunes(pipeWriter, await Db.LoadFortunesRows());
-        }
-
-        private void OutputFortunes(PipeWriter pipeWriter, List<Fortune> model)
-        {
-            var writer = GetWriter(pipeWriter, sizeHint: 1600); // in reality it's 1361
-
-            writer.Write(_fortunesPreamble);
-
-            var lengthWriter = writer;
-            writer.Write(_contentLengthGap);
-
-            // Date header
-            writer.Write(DateHeader.HeaderBytes);
-
-            var bodyStart = writer.Buffered;
-            // Body
-            writer.Write(_fortunesTableStart);
-            foreach (var item in model)
-            {
-                writer.Write(_fortunesRowStart);
-                writer.WriteNumeric((uint)item.Id);
-                writer.Write(_fortunesColumn);
-                writer.WriteUtf8String(HtmlEncoder.Encode(item.Message));
-                writer.Write(_fortunesRowEnd);
-            }
-            writer.Write(_fortunesTableEnd);
-            lengthWriter.WriteNumeric((uint)(writer.Buffered - bodyStart));
-
-            writer.Commit();
-        }
-    }
-}
-
-#endif

+ 0 - 295
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs

@@ -1,295 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Buffers;
-using System.IO.Pipelines;
-using System.Runtime.CompilerServices;
-using System.Text.Encodings.Web;
-using System.Text.Unicode;
-using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
-
-namespace PlatformBenchmarks;
-
-public partial class BenchmarkApplication : IHttpConnection
-{
-    private State _state;
-
-    public PipeReader Reader { get; set; }
-    public PipeWriter Writer { get; set; }
-
-    protected HtmlEncoder HtmlEncoder { get; } = CreateHtmlEncoder();
-
-    private HttpParser<ParsingAdapter> Parser { get; } = new HttpParser<ParsingAdapter>();
-
-    public async Task ExecuteAsync()
-    {
-        try
-        {
-            await ProcessRequestsAsync();
-
-            Reader.Complete();
-        }
-        catch (Exception ex)
-        {
-            Reader.Complete(ex);
-        }
-        finally
-        {
-            Writer.Complete();
-        }
-    }
-
-    private static HtmlEncoder CreateHtmlEncoder()
-    {
-        var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana);
-        settings.AllowCharacter('\u2014');  // allow EM DASH through
-        return HtmlEncoder.Create(settings);
-    }
-
-#if !DATABASE
-    private async Task ProcessRequestsAsync()
-    {
-        while (true)
-        {
-            var readResult = await Reader.ReadAsync(default);
-            var buffer = readResult.Buffer;
-            var isCompleted = readResult.IsCompleted;
-
-            if (buffer.IsEmpty && isCompleted)
-            {
-                return;
-            }
-
-            if (!HandleRequests(buffer, isCompleted))
-            {
-                return;
-            }
-
-            await Writer.FlushAsync(default);
-        }
-    }
-
-    private bool HandleRequests(in ReadOnlySequence<byte> buffer, bool isCompleted)
-    {
-        var reader = new SequenceReader<byte>(buffer);
-        var writer = GetWriter(Writer, sizeHint: 160 * 16); // 160*16 is for Plaintext, for Json 160 would be enough
-
-        while (true)
-        {
-            if (!ParseHttpRequest(ref reader, isCompleted))
-            {
-                return false;
-            }
-
-            if (_state == State.Body)
-            {
-                ProcessRequest(ref writer);
-
-                _state = State.StartLine;
-
-                if (!reader.End)
-                {
-                    // More input data to parse
-                    continue;
-                }
-            }
-
-            // No more input or incomplete data, Advance the Reader
-            Reader.AdvanceTo(reader.Position, buffer.End);
-            break;
-        }
-
-        writer.Commit();
-        return true;
-    }
-
-    private bool ParseHttpRequest(ref SequenceReader<byte> reader, bool isCompleted)
-    {
-        var state = _state;
-
-        if (state == State.StartLine)
-        {
-            if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
-            {
-                state = State.Headers;
-            }
-        }
-
-        if (state == State.Headers)
-        {
-            var success = Parser.ParseHeaders(new ParsingAdapter(this), ref reader);
-
-            if (success)
-            {
-                state = State.Body;
-            }
-        }
-
-        if (state != State.Body && isCompleted)
-        {
-            ThrowUnexpectedEndOfData();
-        }
-
-        _state = state;
-        return true;
-    }
-#else
-        private async Task ProcessRequestsAsync()
-        {
-            while (true)
-            {
-                var readResult = await Reader.ReadAsync();
-                var buffer = readResult.Buffer;
-                var isCompleted = readResult.IsCompleted;
-
-                if (buffer.IsEmpty && isCompleted)
-                {
-                    return;
-                }
-
-                while (true)
-                {
-                    if (!ParseHttpRequest(ref buffer, isCompleted))
-                    {
-                        return;
-                    }
-
-                    if (_state == State.Body)
-                    {
-                        await ProcessRequestAsync();
-
-                        _state = State.StartLine;
-
-                        if (!buffer.IsEmpty)
-                        {
-                            // More input data to parse
-                            continue;
-                        }
-                    }
-
-                    // No more input or incomplete data, Advance the Reader
-                    Reader.AdvanceTo(buffer.Start, buffer.End);
-                    break;
-                }
-
-                await Writer.FlushAsync();
-            }
-        }
-
-        private bool ParseHttpRequest(ref ReadOnlySequence<byte> buffer, bool isCompleted)
-        {
-            var reader = new SequenceReader<byte>(buffer);
-            var state = _state;
-
-            if (state == State.StartLine)
-            {
-                if (Parser.ParseRequestLine(new ParsingAdapter(this), ref reader))
-                {
-                    state = State.Headers;
-                }
-            }
-
-            if (state == State.Headers)
-            {
-                var success = Parser.ParseHeaders(new ParsingAdapter(this), ref reader);
-
-                if (success)
-                {
-                    state = State.Body;
-                }
-            }
-
-            if (state != State.Body && isCompleted)
-            {
-                ThrowUnexpectedEndOfData();
-            }
-
-            _state = state;
-
-            if (state == State.Body)
-            {
-                // Complete request read, consumed and examined are the same (length 0)
-                buffer = buffer.Slice(reader.Position, 0);
-            }
-            else
-            {
-                // In-complete request read, consumed is current position and examined is the remaining.
-                buffer = buffer.Slice(reader.Position);
-            }
-
-            return true;
-        }
-#endif
-
-    public void OnStaticIndexedHeader(int index)
-    {
-    }
-
-    public void OnStaticIndexedHeader(int index, ReadOnlySpan<byte> value)
-    {
-    }
-
-    public void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value)
-    {
-    }
-
-    public void OnHeadersComplete(bool endStream)
-    {
-    }
-
-    private static void ThrowUnexpectedEndOfData()
-    {
-        throw new InvalidOperationException("Unexpected end of data!");
-    }
-
-    private enum State
-    {
-        StartLine,
-        Headers,
-        Body
-    }
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    private static BufferWriter<WriterAdapter> GetWriter(PipeWriter pipeWriter, int sizeHint)
-        => new(new WriterAdapter(pipeWriter), sizeHint);
-
-    private struct WriterAdapter : IBufferWriter<byte>
-    {
-        public PipeWriter Writer;
-
-        public WriterAdapter(PipeWriter writer)
-            => Writer = writer;
-
-        public void Advance(int count)
-            => Writer.Advance(count);
-
-        public Memory<byte> GetMemory(int sizeHint = 0)
-            => Writer.GetMemory(sizeHint);
-
-        public Span<byte> GetSpan(int sizeHint = 0)
-            => Writer.GetSpan(sizeHint);
-    }
-
-    private struct ParsingAdapter : IHttpRequestLineHandler, IHttpHeadersHandler
-    {
-        public BenchmarkApplication RequestHandler;
-
-        public ParsingAdapter(BenchmarkApplication requestHandler)
-            => RequestHandler = requestHandler;
-
-        public void OnStaticIndexedHeader(int index)
-            => RequestHandler.OnStaticIndexedHeader(index);
-
-        public void OnStaticIndexedHeader(int index, ReadOnlySpan<byte> value)
-            => RequestHandler.OnStaticIndexedHeader(index, value);
-
-        public void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value)
-            => RequestHandler.OnHeader(name, value);
-
-        public void OnHeadersComplete(bool endStream)
-            => RequestHandler.OnHeadersComplete(endStream);
-
-        public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
-            => RequestHandler.OnStartLine(versionAndMethod, targetPath, startLine);
-    }
-}

+ 0 - 34
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Json.cs

@@ -1,34 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Buffers;
-using System.Text.Json;
-
-namespace PlatformBenchmarks;
-
-public partial class BenchmarkApplication
-{
-    private readonly static uint _jsonPayloadSize = (uint)JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage).Length;
-
-    private readonly static AsciiString _jsonPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeJson + _crlf +
-        _headerContentLength + _jsonPayloadSize.ToString();
-
-    private static void Json(ref BufferWriter<WriterAdapter> writer, IBufferWriter<byte> bodyWriter)
-    {
-        writer.Write(_jsonPreamble);
-
-        // Date header
-        writer.Write(DateHeader.HeaderBytes);
-
-        writer.Commit();
-
-        Utf8JsonWriter utf8JsonWriter = t_writer ??= new Utf8JsonWriter(bodyWriter, new JsonWriterOptions { SkipValidation = true });
-        utf8JsonWriter.Reset(bodyWriter);
-
-        // Body
-        JsonSerializer.Serialize(utf8JsonWriter, new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage);
-    }
-}

+ 0 - 46
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.MultipleQueries.cs

@@ -1,46 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if DATABASE
-
-using System.IO.Pipelines;
-using System.Text.Json;
-using System.Text.Json.Serialization.Metadata;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks
-{
-    public partial class BenchmarkApplication
-    {
-        private async Task MultipleQueries(PipeWriter pipeWriter, int count)
-        {
-            OutputMultipleQueries(pipeWriter, await Db.LoadMultipleQueriesRows(count), SerializerContext.WorldArray);
-        }
-
-        private static void OutputMultipleQueries<TWorld>(PipeWriter pipeWriter, TWorld[] rows, JsonTypeInfo<TWorld[]> jsonTypeInfo)
-        {
-            var writer = GetWriter(pipeWriter, sizeHint: 160 * rows.Length); // in reality it's 152 for one
-
-            writer.Write(_dbPreamble);
-
-            var lengthWriter = writer;
-            writer.Write(_contentLengthGap);
-
-            // Date header
-            writer.Write(DateHeader.HeaderBytes);
-
-            writer.Commit();
-
-            Utf8JsonWriter utf8JsonWriter = t_writer ??= new Utf8JsonWriter(pipeWriter, new JsonWriterOptions { SkipValidation = true });
-            utf8JsonWriter.Reset(pipeWriter);
-
-            // Body
-            JsonSerializer.Serialize<TWorld[]>(utf8JsonWriter, rows, jsonTypeInfo);
-
-            // Content-Length
-            lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
-        }
-    }
-}
-
-#endif

+ 0 - 24
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Plaintext.cs

@@ -1,24 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace PlatformBenchmarks;
-
-public partial class BenchmarkApplication
-{
-    private readonly static AsciiString _plaintextPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeText + _crlf +
-        _headerContentLength + _plainTextBody.Length.ToString();
-
-    private static void PlainText(ref BufferWriter<WriterAdapter> writer)
-    {
-        writer.Write(_plaintextPreamble);
-
-        // Date header
-        writer.Write(DateHeader.HeaderBytes);
-
-        // Body
-        writer.Write(_plainTextBody);
-    }
-}

+ 0 - 45
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.SingleQuery.cs

@@ -1,45 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if DATABASE
-
-using System.IO.Pipelines;
-using System.Text.Json;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks
-{
-    public partial class BenchmarkApplication
-    {
-        private async Task SingleQuery(PipeWriter pipeWriter)
-        {
-            OutputSingleQuery(pipeWriter, await Db.LoadSingleQueryRow());
-        }
-
-        private static void OutputSingleQuery(PipeWriter pipeWriter, World row)
-        {
-            var writer = GetWriter(pipeWriter, sizeHint: 180); // in reality it's 150
-
-            writer.Write(_dbPreamble);
-
-            var lengthWriter = writer;
-            writer.Write(_contentLengthGap);
-
-            // Date header
-            writer.Write(DateHeader.HeaderBytes);
-
-            writer.Commit();
-
-            Utf8JsonWriter utf8JsonWriter = t_writer ??= new Utf8JsonWriter(pipeWriter, new JsonWriterOptions { SkipValidation = true });
-            utf8JsonWriter.Reset(pipeWriter);
-
-            // Body
-            JsonSerializer.Serialize(utf8JsonWriter, row, SerializerContext.World);
-
-            // Content-Length
-            lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
-        }
-    }
-}
-
-#endif

+ 0 - 45
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.Updates.cs

@@ -1,45 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if DATABASE
-
-using System.IO.Pipelines;
-using System.Text.Json;
-using System.Threading.Tasks;
-
-namespace PlatformBenchmarks
-{
-    public partial class BenchmarkApplication
-    {
-        private async Task Updates(PipeWriter pipeWriter, int count)
-        {
-            OutputUpdates(pipeWriter, await Db.LoadMultipleUpdatesRows(count));
-        }
-
-        private static void OutputUpdates(PipeWriter pipeWriter, World[] rows)
-        {
-            var writer = GetWriter(pipeWriter, sizeHint: 120 * rows.Length); // in reality it's 112 for one
-
-            writer.Write(_dbPreamble);
-
-            var lengthWriter = writer;
-            writer.Write(_contentLengthGap);
-
-            // Date header
-            writer.Write(DateHeader.HeaderBytes);
-
-            writer.Commit();
-
-            Utf8JsonWriter utf8JsonWriter = t_writer ??= new Utf8JsonWriter(pipeWriter, new JsonWriterOptions { SkipValidation = true });
-            utf8JsonWriter.Reset(pipeWriter);
-
-            // Body
-            JsonSerializer.Serialize( utf8JsonWriter, rows, SerializerContext.WorldArray);
-
-            // Content-Length
-            lengthWriter.WriteNumeric((uint)utf8JsonWriter.BytesCommitted);
-        }
-    }
-}
-
-#endif

+ 0 - 197
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.cs

@@ -1,197 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Buffers.Text;
-using System.IO.Pipelines;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using System.Threading.Tasks;
-
-using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
-
-namespace PlatformBenchmarks;
-
-public partial class BenchmarkApplication
-{
-    private readonly static AsciiString _applicationName = "Kestrel Platform-Level Application";
-    public static AsciiString ApplicationName => _applicationName;
-
-    private readonly static AsciiString _crlf = "\r\n";
-    private readonly static AsciiString _eoh = "\r\n\r\n"; // End Of Headers
-    private readonly static AsciiString _http11OK = "HTTP/1.1 200 OK\r\n";
-    private readonly static AsciiString _http11NotFound = "HTTP/1.1 404 Not Found\r\n";
-    private readonly static AsciiString _headerServer = "Server: K";
-    private readonly static AsciiString _headerContentLength = "Content-Length: ";
-    private readonly static AsciiString _headerContentLengthZero = "Content-Length: 0";
-    private readonly static AsciiString _headerContentTypeText = "Content-Type: text/plain";
-    private readonly static AsciiString _headerContentTypeJson = "Content-Type: application/json";
-    private readonly static AsciiString _headerContentTypeHtml = "Content-Type: text/html; charset=UTF-8";
-
-    private readonly static AsciiString _dbPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeJson + _crlf +
-        _headerContentLength;
-
-    private readonly static AsciiString _plainTextBody = "Hello, World!";
-
-    private static readonly JsonContext SerializerContext = JsonContext.Default;
-
-    [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Serialization, PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
-    [JsonSerializable(typeof(JsonMessage))]
-    [JsonSerializable(typeof(CachedWorld[]))]
-    [JsonSerializable(typeof(World[]))]
-    private sealed partial class JsonContext : JsonSerializerContext
-    {
-    }
-
-    private readonly static AsciiString _fortunesTableStart = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
-    private readonly static AsciiString _fortunesRowStart = "<tr><td>";
-    private readonly static AsciiString _fortunesColumn = "</td><td>";
-    private readonly static AsciiString _fortunesRowEnd = "</td></tr>";
-    private readonly static AsciiString _fortunesTableEnd = "</table></body></html>";
-    private readonly static AsciiString _contentLengthGap = new string(' ', 4);
-
-#if DATABASE
-        public static RawDb Db { get; set; }
-#endif
-
-    [ThreadStatic]
-    private static Utf8JsonWriter t_writer;
-
-    public static class Paths
-    {
-        public readonly static AsciiString Json = "/json";
-        public readonly static AsciiString Plaintext = "/plaintext";
-        public readonly static AsciiString SingleQuery = "/db";
-        public readonly static AsciiString Fortunes = "/fortunes";
-        public readonly static AsciiString Updates = "/updates/";
-        public readonly static AsciiString MultipleQueries = "/queries/";
-        public readonly static AsciiString Caching = "/cached-worlds/";
-    }
-
-    private RequestType _requestType;
-    private int _queries;
-
-    public void OnStartLine(HttpVersionAndMethod versionAndMethod, TargetOffsetPathLength targetPath, Span<byte> startLine)
-    {
-        _requestType = versionAndMethod.Method == Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod.Get ? GetRequestType(startLine.Slice(targetPath.Offset, targetPath.Length), ref _queries) : RequestType.NotRecognized;
-    }
-
-    private RequestType GetRequestType(ReadOnlySpan<byte> path, ref int queries)
-    {
-#if !DATABASE
-        if (path.Length == 10 && path.SequenceEqual(Paths.Plaintext))
-        {
-            return RequestType.PlainText;
-        }
-        else if (path.Length == 5 && path.SequenceEqual(Paths.Json))
-        {
-            return RequestType.Json;
-        }
-#else
-            if (path.Length == 3 && path[0] == '/' && path[1] == 'd' && path[2] == 'b')
-            {
-                return RequestType.SingleQuery;
-            }
-            else if (path.Length == 9 && path[1] == 'f' && path.SequenceEqual(Paths.Fortunes))
-            {
-                return RequestType.Fortunes;
-            }
-            else if (path.Length >= 15 && path[1] == 'c' && path.StartsWith(Paths.Caching))
-            {
-                queries = ParseQueries(path.Slice(15));
-                return RequestType.Caching;
-            }
-            else if (path.Length >= 9 && path[1] == 'u' && path.StartsWith(Paths.Updates))
-            {
-                queries = ParseQueries(path.Slice(9));
-                return RequestType.Updates;
-            }
-            else if (path.Length >= 9 && path[1] == 'q' && path.StartsWith(Paths.MultipleQueries))
-            {
-                queries = ParseQueries(path.Slice(9));
-                return RequestType.MultipleQueries;
-            }
-#endif
-        return RequestType.NotRecognized;
-    }
-
-
-#if !DATABASE
-    private void ProcessRequest(ref BufferWriter<WriterAdapter> writer)
-    {
-        if (_requestType == RequestType.PlainText)
-        {
-            PlainText(ref writer);
-        }
-        else if (_requestType == RequestType.Json)
-        {
-            Json(ref writer, Writer);
-        }
-        else
-        {
-            Default(ref writer);
-        }
-    }
-#else
-
-        private static int ParseQueries(ReadOnlySpan<byte> parameter)
-        {
-            if (!Utf8Parser.TryParse(parameter, out int queries, out _) || queries < 1)
-            {
-                queries = 1;
-            }
-            else if (queries > 500)
-            {
-                queries = 500;
-            }
-
-            return queries;
-        }
-
-        private Task ProcessRequestAsync() => _requestType switch
-        {
-            RequestType.Fortunes => Fortunes(Writer),
-            RequestType.SingleQuery => SingleQuery(Writer),
-            RequestType.Caching => Caching(Writer, _queries),
-            RequestType.Updates => Updates(Writer, _queries),
-            RequestType.MultipleQueries => MultipleQueries(Writer, _queries),
-            _ => Default(Writer)
-        };
-
-        private static Task Default(PipeWriter pipeWriter)
-        {
-            var writer = GetWriter(pipeWriter, sizeHint: _defaultPreamble.Length + DateHeader.HeaderBytes.Length);
-            Default(ref writer);
-            writer.Commit();
-            return Task.CompletedTask;
-        }
-#endif
-    private readonly static AsciiString _defaultPreamble =
-        _http11NotFound +
-        _headerServer + _crlf +
-        _headerContentTypeText + _crlf +
-        _headerContentLengthZero;
-
-    private static void Default(ref BufferWriter<WriterAdapter> writer)
-    {
-        writer.Write(_defaultPreamble);
-
-        // Date header
-        writer.Write(DateHeader.HeaderBytes);
-    }
-
-    private enum RequestType
-    {
-        NotRecognized,
-        PlainText,
-        Json,
-        Fortunes,
-        SingleQuery,
-        Caching,
-        Updates,
-        MultipleQueries
-    }
-}

+ 0 - 58
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs

@@ -1,58 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Net;
-using System.Runtime.InteropServices;
-
-namespace PlatformBenchmarks;
-
-public static class BenchmarkConfigurationHelpers
-{
-    public static IWebHostBuilder UseBenchmarksConfiguration(this IWebHostBuilder builder, IConfiguration configuration)
-    {
-        builder.UseConfiguration(configuration);
-
-        builder.UseSockets(options =>
-        {
-            if (int.TryParse(builder.GetSetting("threadCount"), out int threadCount))
-            {
-                options.IOQueueCount = threadCount;
-            }
-
-            options.WaitForDataBeforeAllocatingBuffer = false;
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
-            {
-                options.UnsafePreferInlineScheduling = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS") == "1";
-            }
-
-            Console.WriteLine($"Options: WaitForData={options.WaitForDataBeforeAllocatingBuffer}, PreferInlineScheduling={options.UnsafePreferInlineScheduling}, IOQueue={options.IOQueueCount}");
-        });
-
-        return builder;
-    }
-
-    public static IPEndPoint CreateIPEndPoint(this IConfiguration config)
-    {
-        var url = config["server.urls"] ?? config["urls"];
-
-        if (string.IsNullOrEmpty(url))
-        {
-            return new IPEndPoint(IPAddress.Loopback, 8080);
-        }
-
-        var address = BindingAddress.Parse(url);
-
-        IPAddress ip;
-
-        if (string.Equals(address.Host, "localhost", StringComparison.OrdinalIgnoreCase))
-        {
-            ip = IPAddress.Loopback;
-        }
-        else if (!IPAddress.TryParse(address.Host, out ip))
-        {
-            ip = IPAddress.IPv6Any;
-        }
-
-        return new IPEndPoint(ip, address.Port);
-    }
-}

+ 0 - 62
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferExtensions.cs

@@ -1,62 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Buffers;
-using System.Runtime.CompilerServices;
-using System.Text;
-
-namespace PlatformBenchmarks;
-
-// Same as KestrelHttpServer\src\Kestrel.Core\Internal\Http\PipelineExtensions.cs
-// However methods accept T : struct, IBufferWriter<byte> rather than PipeWriter.
-// This allows a struct wrapper to turn CountingBufferWriter into a non-shared generic,
-// while still offering the WriteNumeric extension.
-
-public static class BufferExtensions
-{
-    private const int _maxULongByteLength = 20;
-
-    [ThreadStatic]
-    private static byte[] _numericBytesScratch;
-
-    internal static void WriteUtf8String<T>(ref this BufferWriter<T> buffer, string text)
-         where T : struct, IBufferWriter<byte>
-    {
-        var byteCount = Encoding.UTF8.GetByteCount(text);
-        buffer.Ensure(byteCount);
-        byteCount = Encoding.UTF8.GetBytes(text.AsSpan(), buffer.Span);
-        buffer.Advance(byteCount);
-    }
-    [MethodImpl(MethodImplOptions.NoInlining)]
-    internal static void WriteNumericMultiWrite<T>(ref this BufferWriter<T> buffer, uint number)
-         where T : IBufferWriter<byte>
-    {
-        const byte AsciiDigitStart = (byte)'0';
-
-        var value = number;
-        var position = _maxULongByteLength;
-        var byteBuffer = NumericBytesScratch;
-        do
-        {
-            // Consider using Math.DivRem() if available
-            var quotient = value / 10;
-            byteBuffer[--position] = (byte)(AsciiDigitStart + (value - quotient * 10)); // 0x30 = '0'
-            value = quotient;
-        }
-        while (value != 0);
-
-        var length = _maxULongByteLength - position;
-        buffer.Write(new ReadOnlySpan<byte>(byteBuffer, position, length));
-    }
-
-    private static byte[] NumericBytesScratch => _numericBytesScratch ?? CreateNumericBytesScratch();
-
-    [MethodImpl(MethodImplOptions.NoInlining)]
-    private static byte[] CreateNumericBytesScratch()
-    {
-        var bytes = new byte[_maxULongByteLength];
-        _numericBytesScratch = bytes;
-        return bytes;
-    }
-}

+ 0 - 141
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferWriter.cs

@@ -1,141 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Buffers;
-using System.Runtime.CompilerServices;
-
-namespace PlatformBenchmarks;
-
-public ref struct BufferWriter<T> where T : IBufferWriter<byte>
-{
-    private readonly T _output;
-    private Span<byte> _span;
-    private int _buffered;
-
-    public BufferWriter(T output, int sizeHint)
-    {
-        _buffered = 0;
-        _output = output;
-        _span = output.GetSpan(sizeHint);
-    }
-
-    public Span<byte> Span => _span;
-
-    public T Output => _output;
-
-    public int Buffered => _buffered;
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    public void Commit()
-    {
-        var buffered = _buffered;
-        if (buffered > 0)
-        {
-            _buffered = 0;
-            _output.Advance(buffered);
-        }
-    }
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    public void Advance(int count)
-    {
-        _buffered += count;
-        _span = _span.Slice(count);
-    }
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    public void Write(ReadOnlySpan<byte> source)
-    {
-        if (_span.Length >= source.Length)
-        {
-            source.CopyTo(_span);
-            Advance(source.Length);
-        }
-        else
-        {
-            WriteMultiBuffer(source);
-        }
-    }
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    public void Ensure(int count = 1)
-    {
-        if (_span.Length < count)
-        {
-            EnsureMore(count);
-        }
-    }
-
-    [MethodImpl(MethodImplOptions.NoInlining)]
-    private void EnsureMore(int count = 0)
-    {
-        if (_buffered > 0)
-        {
-            Commit();
-        }
-
-        _span = _output.GetSpan(count);
-    }
-
-    private void WriteMultiBuffer(ReadOnlySpan<byte> source)
-    {
-        while (source.Length > 0)
-        {
-            if (_span.Length == 0)
-            {
-                EnsureMore();
-            }
-
-            var writable = Math.Min(source.Length, _span.Length);
-            source[..writable].CopyTo(_span);
-            source = source[writable..];
-            Advance(writable);
-        }
-    }
-
-    [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    internal void WriteNumeric(uint number)
-    {
-        const byte AsciiDigitStart = (byte)'0';
-
-        var span = this.Span;
-
-        // Fast path, try copying to the available memory directly
-        var advanceBy = 0;
-        if (span.Length >= 3)
-        {
-            if (number < 10)
-            {
-                span[0] = (byte)(number + AsciiDigitStart);
-                advanceBy = 1;
-            }
-            else if (number < 100)
-            {
-                var tens = (byte)((number * 205u) >> 11); // div10, valid to 1028
-
-                span[0] = (byte)(tens + AsciiDigitStart);
-                span[1] = (byte)(number - (tens * 10) + AsciiDigitStart);
-                advanceBy = 2;
-            }
-            else if (number < 1000)
-            {
-                var digit0 = (byte)((number * 41u) >> 12); // div100, valid to 1098
-                var digits01 = (byte)((number * 205u) >> 11); // div10, valid to 1028
-
-                span[0] = (byte)(digit0 + AsciiDigitStart);
-                span[1] = (byte)(digits01 - (digit0 * 10) + AsciiDigitStart);
-                span[2] = (byte)(number - (digits01 * 10) + AsciiDigitStart);
-                advanceBy = 3;
-            }
-        }
-
-        if (advanceBy > 0)
-        {
-            Advance(advanceBy);
-        }
-        else
-        {
-            BufferExtensions.WriteNumericMultiWrite(ref this, number);
-        }
-    }
-}

+ 0 - 11
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Configuration/AppSettings.cs

@@ -1,11 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace PlatformBenchmarks;
-
-public class AppSettings
-{
-    public string ConnectionString { get; set; }
-
-    public DatabaseServer Database { get; set; } = DatabaseServer.None;
-}

+ 0 - 12
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Configuration/DatabaseServer.cs

@@ -1,12 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved. 
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
-
-namespace PlatformBenchmarks;
-
-public enum DatabaseServer
-{
-    None,
-    SqlServer,
-    PostgreSql,
-    MySql
-}

+ 0 - 41
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/BatchUpdateString.cs

@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved. 
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
-
-namespace PlatformBenchmarks;
-
-internal class BatchUpdateString
-{
-    private const int MaxBatch = 500;
-
-    public static DatabaseServer DatabaseServer;
-
-    internal static readonly string[] Ids = Enumerable.Range(0, MaxBatch).Select(i => $"@Id_{i}").ToArray();
-    internal static readonly string[] Randoms = Enumerable.Range(0, MaxBatch).Select(i => $"@Random_{i}").ToArray();
-
-    private static readonly string[] _queries = new string[MaxBatch + 1];
-
-    public static string Query(int batchSize)
-    {
-        if (_queries[batchSize] != null)
-        {
-            return _queries[batchSize];
-        }
-
-        var lastIndex = batchSize - 1;
-
-        var sb = StringBuilderCache.Acquire();
-
-        if (DatabaseServer == DatabaseServer.PostgreSql)
-        {
-            sb.Append("UPDATE world SET randomNumber = temp.randomNumber FROM (VALUES ");
-            Enumerable.Range(0, lastIndex).ToList().ForEach(i => sb.Append($"(@Id_{i}, @Random_{i}), "));
-            sb.Append($"(@Id_{lastIndex}, @Random_{lastIndex}) ORDER BY 1) AS temp(id, randomNumber) WHERE temp.id = world.id");
-        }
-        else
-        {
-            Enumerable.Range(0, batchSize).ToList().ForEach(i => sb.Append($"UPDATE world SET randomnumber = @Random_{i} WHERE id = @Id_{i};"));
-        }
-
-        return _queries[batchSize] = StringBuilderCache.GetStringAndRelease(sb);
-    }
-}

+ 0 - 13
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/CachedWorld.cs

@@ -1,13 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace PlatformBenchmarks;
-
-public sealed class CachedWorld
-{
-    public int Id { get; set; }
-
-    public int RandomNumber { get; set; }
-
-    public static implicit operator CachedWorld(World world) => new CachedWorld { Id = world.Id, RandomNumber = world.RandomNumber };
-}

+ 0 - 22
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Fortune.cs

@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved. 
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
-
-namespace PlatformBenchmarks;
-
-public readonly struct Fortune : IComparable<Fortune>, IComparable
-{
-    public Fortune(int id, string message)
-    {
-        Id = id;
-        Message = message;
-    }
-
-    public int Id { get; }
-
-    public string Message { get; }
-
-    public int CompareTo(object obj) => throw new InvalidOperationException("The non-generic CompareTo should not be used");
-
-    // Performance critical, using culture insensitive comparison
-    public int CompareTo(Fortune other) => string.CompareOrdinal(Message, other.Message);
-}

+ 0 - 9
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/JsonMessage.cs

@@ -1,9 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace PlatformBenchmarks;
-
-public struct JsonMessage
-{
-    public string message { get; set; }
-}

+ 0 - 272
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs

@@ -1,272 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if MYSQLCONNECTOR
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Caching.Memory;
-using MySqlConnector;
-
-namespace PlatformBenchmarks
-{
-    // Is semantically identical to RawDbNpgsql.cs.
-    // If you are changing RawDbMySqlConnector.cs, also consider changing RawDbNpgsql.cs.
-    public class RawDb
-    {
-        private readonly ConcurrentRandom _random;
-        private readonly string _connectionString;
-        private readonly MemoryCache _cache = new(
-            new MemoryCacheOptions
-            {
-                ExpirationScanFrequency = TimeSpan.FromMinutes(60)
-            });
-
-        public RawDb(ConcurrentRandom random, AppSettings appSettings)
-        {
-            _random = random;
-            _connectionString = appSettings.ConnectionString;
-        }
-
-        public async Task<World> LoadSingleQueryRow()
-        {
-            using (var db = new MySqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, _) = await CreateReadCommandAsync(db);
-                using (cmd)
-                {
-                    return await ReadSingleRow(cmd);
-                }
-            }
-        }
-
-        public async Task<World[]> LoadMultipleQueriesRows(int count)
-        {
-            var result = new World[count];
-
-            using (var db = new MySqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, idParameter) = await CreateReadCommandAsync(db);
-                using (cmd)
-                {
-                    for (int i = 0; i < result.Length; i++)
-                    {
-                        result[i] = await ReadSingleRow(cmd);
-                        idParameter.Value = _random.Next(1, 10001);
-                    }
-                }
-            }
-
-            return result;
-        }
-
-        public Task<CachedWorld[]> LoadCachedQueries(int count)
-        {
-            var result = new CachedWorld[count];
-            var cacheKeys = _cacheKeys;
-            var cache = _cache;
-            var random = _random;
-            for (var i = 0; i < result.Length; i++)
-            {
-                var id = random.Next(1, 10001);
-                var key = cacheKeys[id];
-                if (cache.TryGetValue(key, out object cached))
-                {
-                    result[i] = (CachedWorld)cached;
-                }
-                else
-                {
-                    return LoadUncachedQueries(id, i, count, this, result);
-                }
-            }
-
-            return Task.FromResult(result);
-
-            static async Task<CachedWorld[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, CachedWorld[] result)
-            {
-                using (var db = new MySqlConnection(rawdb._connectionString))
-                {
-                    await db.OpenAsync();
-
-                    var (cmd, idParameter) = await rawdb.CreateReadCommandAsync(db);
-                    using (cmd)
-                    {
-                        Func<ICacheEntry, Task<CachedWorld>> create = async _ =>
-                        {
-                            return await rawdb.ReadSingleRow(cmd);
-                        };
-
-                        var cacheKeys = _cacheKeys;
-                        var key = cacheKeys[id];
-
-                        idParameter.Value = id;
-
-                        for (; i < result.Length; i++)
-                        {
-                            result[i] = await rawdb._cache.GetOrCreateAsync(key, create);
-
-                            id = rawdb._random.Next(1, 10001);
-                            idParameter.Value = id;
-                            key = cacheKeys[id];
-                        }
-                    }
-                }
-
-                return result;
-            }
-        }
-
-        public async Task PopulateCache()
-        {
-            using (var db = new MySqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, idParameter) = await CreateReadCommandAsync(db);
-                using (cmd)
-                {
-                    var cacheKeys = _cacheKeys;
-                    var cache = _cache;
-                    for (var i = 1; i < 10001; i++)
-                    {
-                        idParameter.Value = i;
-                        cache.Set<CachedWorld>(cacheKeys[i], await ReadSingleRow(cmd));
-                    }
-                }
-            }
-
-            Console.WriteLine("Caching Populated");
-        }
-
-        public async Task<World[]> LoadMultipleUpdatesRows(int count)
-        {
-            var results = new World[count];
-
-            using (var db = new MySqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (queryCmd, queryParameter) = await CreateReadCommandAsync(db);
-                using (queryCmd)
-                {
-                    for (int i = 0; i < results.Length; i++)
-                    {
-                        results[i] = await ReadSingleRow(queryCmd);
-                        queryParameter.Value = _random.Next(1, 10001);
-                    }
-                }
-
-                using (var updateCmd = new MySqlCommand(BatchUpdateString.Query(count), db))
-                {
-                    var ids = BatchUpdateString.Ids;
-                    var randoms = BatchUpdateString.Randoms;
-
-                    for (int i = 0; i < results.Length; i++)
-                    {
-                        var randomNumber = _random.Next(1, 10001);
-
-                        updateCmd.Parameters.Add(new MySqlParameter(ids[i], results[i].Id));
-                        updateCmd.Parameters.Add(new MySqlParameter(randoms[i], randomNumber));
-
-                        results[i].RandomNumber = randomNumber;
-                    }
-
-                    await updateCmd.ExecuteNonQueryAsync();
-                }
-            }
-
-            return results;
-        }
-
-        public async Task<List<Fortune>> LoadFortunesRows()
-        {
-            var result = new List<Fortune>();
-
-            using (var db = new MySqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                using (var cmd = new MySqlCommand("SELECT id, message FROM fortune", db))
-                {
-                    await cmd.PrepareAsync();
-                    
-                    using (var rdr = await cmd.ExecuteReaderAsync())
-                    {
-                        while (await rdr.ReadAsync())
-                        {
-                            result.Add(
-                                new Fortune
-                                (
-                                    id: rdr.GetInt32(0),
-                                    message: rdr.GetString(1)
-                                ));
-                        }
-                    }
-                }
-            }
-
-            result.Add(new Fortune(id: 0, message: "Additional fortune added at request time." ));
-            result.Sort();
-
-            return result;
-        }
-
-        private async Task<(MySqlCommand readCmd, MySqlParameter idParameter)> CreateReadCommandAsync(MySqlConnection connection)
-        {
-            var cmd = new MySqlCommand("SELECT id, randomnumber FROM world WHERE id = @Id", connection);
-            var parameter = new MySqlParameter("@Id", _random.Next(1, 10001));
-
-            cmd.Parameters.Add(parameter);
-
-            await cmd.PrepareAsync();
-            
-            return (cmd, parameter);
-        }
-        
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        private async Task<World> ReadSingleRow(MySqlCommand cmd)
-        {
-            using (var rdr = await cmd.ExecuteReaderAsync(System.Data.CommandBehavior.SingleRow))
-            {
-                await rdr.ReadAsync();
-
-                return new World
-                {
-                    Id = rdr.GetInt32(0),
-                    RandomNumber = rdr.GetInt32(1)
-                };
-            }
-        }
-        
-        private static readonly object[] _cacheKeys = Enumerable.Range(0, 10001).Select(i => new CacheKey(i)).ToArray();
-
-        public sealed class CacheKey : IEquatable<CacheKey>
-        {
-            private readonly int _value;
-
-            public CacheKey(int value)
-                => _value = value;
-
-            public bool Equals(CacheKey key)
-                => key._value == _value;
-
-            public override bool Equals(object obj)
-                => ReferenceEquals(obj, this);
-
-            public override int GetHashCode()
-                => _value;
-
-            public override string ToString()
-                => _value.ToString();
-        }
-    }
-}
-
-#endif

+ 0 - 265
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs

@@ -1,265 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-#if NPGSQL
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Caching.Memory;
-using Npgsql;
-
-namespace PlatformBenchmarks
-{
-    // Is semantically identical to RawDbMySqlConnector.cs.
-    // If you are changing RawDbNpgsql.cs, also consider changing RawDbMySqlConnector.cs.
-    public class RawDb
-    {
-        private readonly ConcurrentRandom _random;
-        private readonly string _connectionString;
-        private readonly MemoryCache _cache = new(
-            new MemoryCacheOptions
-            {
-                ExpirationScanFrequency = TimeSpan.FromMinutes(60)
-            });
-
-        public RawDb(ConcurrentRandom random, AppSettings appSettings)
-        {
-            _random = random;
-            _connectionString = appSettings.ConnectionString;
-        }
-
-        public async Task<World> LoadSingleQueryRow()
-        {
-            using (var db = new NpgsqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, _) = CreateReadCommand(db);
-                using (cmd)
-                {
-                    return await ReadSingleRow(cmd);
-                }
-            }
-        }
-
-        public async Task<World[]> LoadMultipleQueriesRows(int count)
-        {
-            var result = new World[count];
-
-            using (var db = new NpgsqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, idParameter) = CreateReadCommand(db);
-                using (cmd)
-                {
-                    for (int i = 0; i < result.Length; i++)
-                    {
-                        result[i] = await ReadSingleRow(cmd);
-                        idParameter.TypedValue = _random.Next(1, 10001);
-                    }
-                }
-            }
-
-            return result;
-        }
-
-        public Task<CachedWorld[]> LoadCachedQueries(int count)
-        {
-            var result = new CachedWorld[count];
-            var cacheKeys = _cacheKeys;
-            var cache = _cache;
-            var random = _random;
-            for (var i = 0; i < result.Length; i++)
-            {
-                var id = random.Next(1, 10001);
-                var key = cacheKeys[id];
-                if (cache.TryGetValue(key, out object cached))
-                {
-                    result[i] = (CachedWorld)cached;
-                }
-                else
-                {
-                    return LoadUncachedQueries(id, i, count, this, result);
-                }
-            }
-
-            return Task.FromResult(result);
-
-            static async Task<CachedWorld[]> LoadUncachedQueries(int id, int i, int count, RawDb rawdb, CachedWorld[] result)
-            {
-                using (var db = new NpgsqlConnection(rawdb._connectionString))
-                {
-                    await db.OpenAsync();
-
-                    var (cmd, idParameter) = rawdb.CreateReadCommand(db);
-                    using (cmd)
-                    {
-                        Func<ICacheEntry, Task<CachedWorld>> create = async _ =>
-                        {
-                            return await rawdb.ReadSingleRow(cmd);
-                        };
-
-                        var cacheKeys = _cacheKeys;
-                        var key = cacheKeys[id];
-
-                        idParameter.TypedValue = id;
-
-                        for (; i < result.Length; i++)
-                        {
-                            result[i] = await rawdb._cache.GetOrCreateAsync(key, create);
-
-                            id = rawdb._random.Next(1, 10001);
-                            idParameter.TypedValue = id;
-                            key = cacheKeys[id];
-                        }
-                    }
-                }
-
-                return result;
-            }
-        }
-
-        public async Task PopulateCache()
-        {
-            using (var db = new NpgsqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (cmd, idParameter) = CreateReadCommand(db);
-                using (cmd)
-                {
-                    var cacheKeys = _cacheKeys;
-                    var cache = _cache;
-                    for (var i = 1; i < 10001; i++)
-                    {
-                        idParameter.TypedValue = i;
-                        cache.Set<CachedWorld>(cacheKeys[i], await ReadSingleRow(cmd));
-                    }
-                }
-            }
-
-            Console.WriteLine("Caching Populated");
-        }
-
-        public async Task<World[]> LoadMultipleUpdatesRows(int count)
-        {
-            var results = new World[count];
-
-            using (var db = new NpgsqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                var (queryCmd, queryParameter) = CreateReadCommand(db);
-                using (queryCmd)
-                {
-                    for (int i = 0; i < results.Length; i++)
-                    {
-                        results[i] = await ReadSingleRow(queryCmd);
-                        queryParameter.TypedValue = _random.Next(1, 10001);
-                    }
-                }
-
-                using (var updateCmd = new NpgsqlCommand(BatchUpdateString.Query(count), db))
-                {
-                    var ids = BatchUpdateString.Ids;
-                    var randoms = BatchUpdateString.Randoms;
-
-                    for (int i = 0; i < results.Length; i++)
-                    {
-                        var randomNumber = _random.Next(1, 10001);
-
-                        updateCmd.Parameters.Add(new NpgsqlParameter<int>(parameterName: ids[i], value: results[i].Id));
-                        updateCmd.Parameters.Add(new NpgsqlParameter<int>(parameterName: randoms[i], value: randomNumber));
-
-                        results[i].RandomNumber = randomNumber;
-                    }
-
-                    await updateCmd.ExecuteNonQueryAsync();
-                }
-            }
-
-            return results;
-        }
-
-        public async Task<List<Fortune>> LoadFortunesRows()
-        {
-            var result = new List<Fortune>(20);
-
-            using (var db = new NpgsqlConnection(_connectionString))
-            {
-                await db.OpenAsync();
-
-                using (var cmd = new NpgsqlCommand("SELECT id, message FROM fortune", db))
-                using (var rdr = await cmd.ExecuteReaderAsync())
-                {
-                    while (await rdr.ReadAsync())
-                    {
-                        result.Add(new Fortune
-                        (
-                            id:rdr.GetInt32(0),
-                            message: rdr.GetString(1)
-                        ));
-                    }
-                }
-            }
-
-            result.Add(new Fortune(id: 0, message: "Additional fortune added at request time." ));
-            result.Sort();
-
-            return result;
-        }
-
-        private (NpgsqlCommand readCmd, NpgsqlParameter<int> idParameter) CreateReadCommand(NpgsqlConnection connection)
-        {
-            var cmd = new NpgsqlCommand("SELECT id, randomnumber FROM world WHERE id = $1", connection);
-            var parameter = new NpgsqlParameter<int> { TypedValue = _random.Next(1, 10001) };
-
-            cmd.Parameters.Add(parameter);
-
-            return (cmd, parameter);
-        }
-
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        private async Task<World> ReadSingleRow(NpgsqlCommand cmd)
-        {
-            using (var rdr = await cmd.ExecuteReaderAsync(System.Data.CommandBehavior.SingleRow))
-            {
-                await rdr.ReadAsync();
-
-                return new World
-                {
-                    Id = rdr.GetInt32(0),
-                    RandomNumber = rdr.GetInt32(1)
-                };
-            }
-        }
-
-        private static readonly object[] _cacheKeys = Enumerable.Range(0, 10001).Select(i => new CacheKey(i)).ToArray();
-
-        public sealed class CacheKey : IEquatable<CacheKey>
-        {
-            private readonly int _value;
-
-            public CacheKey(int value)
-                => _value = value;
-
-            public bool Equals(CacheKey key)
-                => key._value == _value;
-
-            public override bool Equals(object obj)
-                => ReferenceEquals(obj, this);
-
-            public override int GetHashCode()
-                => _value;
-
-            public override string ToString()
-                => _value.ToString();
-        }
-    }
-}
-
-#endif

+ 0 - 29
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/Random.cs

@@ -1,29 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved. 
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
-
-using System.Runtime.CompilerServices;
-
-namespace PlatformBenchmarks;
-
-public class ConcurrentRandom
-{
-    private static int nextSeed = 0;
-
-    // Random isn't thread safe
-    [ThreadStatic]
-    private static Random _random;
-
-    private static Random Random => _random ?? CreateRandom();
-
-    [MethodImpl(MethodImplOptions.NoInlining)]
-    private static Random CreateRandom()
-    {
-        _random = new Random(Interlocked.Increment(ref nextSeed));
-        return _random;
-    }
-
-    public int Next(int minValue, int maxValue)
-    {
-        return Random.Next(minValue, maxValue);
-    }
-}

+ 0 - 14
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Data/World.cs

@@ -1,14 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Runtime.InteropServices;
-
-namespace PlatformBenchmarks;
-
-[StructLayout(LayoutKind.Sequential, Size = 8)]
-public struct World
-{
-    public int Id { get; set; }
-
-    public int RandomNumber { get; set; }
-}

+ 0 - 65
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/DateHeader.cs

@@ -1,65 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Buffers.Text;
-using System.Diagnostics;
-using System.Text;
-
-namespace PlatformBenchmarks;
-
-/// <summary>
-/// Manages the generation of the date header value.
-/// </summary>
-internal static class DateHeader
-{
-    const int prefixLength = 8; // "\r\nDate: ".Length
-    const int dateTimeRLength = 29; // Wed, 14 Mar 2018 14:20:00 GMT
-    const int suffixLength = 2; // crlf
-    const int suffixIndex = dateTimeRLength + prefixLength;
-
-    private static readonly Timer s_timer = new((s) =>
-    {
-        SetDateValues(DateTimeOffset.UtcNow);
-    }, null, 1000, 1000);
-
-    private static byte[] s_headerBytesMaster = new byte[prefixLength + dateTimeRLength + 2 * suffixLength];
-    private static byte[] s_headerBytesScratch = new byte[prefixLength + dateTimeRLength + 2 * suffixLength];
-
-    static DateHeader()
-    {
-        var utf8 = Encoding.ASCII.GetBytes("\r\nDate: ").AsSpan();
-
-        utf8.CopyTo(s_headerBytesMaster);
-        utf8.CopyTo(s_headerBytesScratch);
-        s_headerBytesMaster[suffixIndex] = (byte)'\r';
-        s_headerBytesMaster[suffixIndex + 1] = (byte)'\n';
-        s_headerBytesMaster[suffixIndex + 2] = (byte)'\r';
-        s_headerBytesMaster[suffixIndex + 3] = (byte)'\n';
-        s_headerBytesScratch[suffixIndex] = (byte)'\r';
-        s_headerBytesScratch[suffixIndex + 1] = (byte)'\n';
-        s_headerBytesScratch[suffixIndex + 2] = (byte)'\r';
-        s_headerBytesScratch[suffixIndex + 3] = (byte)'\n';
-
-        SetDateValues(DateTimeOffset.UtcNow);
-        SyncDateTimer();
-    }
-
-    public static void SyncDateTimer() => s_timer.Change(1000, 1000);
-
-    public static ReadOnlySpan<byte> HeaderBytes => s_headerBytesMaster;
-
-    private static void SetDateValues(DateTimeOffset value)
-    {
-        lock (s_headerBytesScratch)
-        {
-            if (!Utf8Formatter.TryFormat(value, s_headerBytesScratch.AsSpan(prefixLength), out var written, 'R'))
-            {
-                throw new Exception("date time format failed");
-            }
-            Debug.Assert(written == dateTimeRLength);
-            var temp = s_headerBytesMaster;
-            s_headerBytesMaster = s_headerBytesScratch;
-            s_headerBytesScratch = temp;
-        }
-    }
-}

+ 0 - 28
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/HttpApplication.cs

@@ -1,28 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Connections;
-
-namespace PlatformBenchmarks;
-
-public static class HttpApplicationConnectionBuilderExtensions
-{
-    public static IConnectionBuilder UseHttpApplication<TConnection>(this IConnectionBuilder builder) where TConnection : IHttpConnection, new()
-    {
-        return builder.Use(next => new HttpApplication<TConnection>().ExecuteAsync);
-    }
-}
-
-public class HttpApplication<TConnection> where TConnection : IHttpConnection, new()
-{
-    public Task ExecuteAsync(ConnectionContext connection)
-    {
-        var httpConnection = new TConnection
-        {
-            Reader = connection.Transport.Input,
-            Writer = connection.Transport.Output
-        };
-        return httpConnection.ExecuteAsync();
-    }
-}

+ 0 - 14
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/IHttpConnection.cs

@@ -1,14 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.IO.Pipelines;
-using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
-
-namespace PlatformBenchmarks;
-
-public interface IHttpConnection : IHttpHeadersHandler, IHttpRequestLineHandler
-{
-    PipeReader Reader { get; set; }
-    PipeWriter Writer { get; set; }
-    Task ExecuteAsync();
-}

+ 0 - 8
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/NuGet.Config

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <packageSources>
-    <clear />
-    <add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
-    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
-  </packageSources>
-</configuration>

+ 0 - 40
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -1,40 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
-  <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
-    <OutputType>Exe</OutputType>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-
-    <!-- Opt out of the "easy mode" of the CoreRT compiler (http://aka.ms/OptimizeCoreRT) -->
-    <TrimmerDefaultAction>link</TrimmerDefaultAction>
-    <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
-    <IlcPgoOptimize>true</IlcPgoOptimize>
-    <IlcTrimMetadata>true</IlcTrimMetadata>
-
-    <!-- This benchmark is marked Stripped, so we might as well do this: -->
-    <UseSystemResourceKeys>true</UseSystemResourceKeys>
-    <EventSourceSupport>false</EventSourceSupport>
-    <DebuggerSupport>false</DebuggerSupport>
-    <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
-    <ImplicitUsings>enable</ImplicitUsings>
-  </PropertyGroup>
-  
-  <PropertyGroup>
-    <DefineConstants Condition=" '$(DatabaseProvider)' != '' ">$(DefineConstants);DATABASE</DefineConstants>
-    <DefineConstants Condition=" '$(DatabaseProvider)' == 'Npgsql' ">$(DefineConstants);NPGSQL</DefineConstants>
-    <DefineConstants Condition=" '$(DatabaseProvider)' == 'MySqlConnector' ">$(DefineConstants);MYSQLCONNECTOR</DefineConstants>
-  </PropertyGroup>
-  
-  <ItemGroup>
-    <IlcArg Include="--instructionset:sse4.2" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <PackageReference Condition=" '$(DatabaseProvider)' == 'Npgsql' " Include="Npgsql" Version="6.0.0" />
-    <PackageReference Condition=" '$(DatabaseProvider)' == 'MySqlConnector' " Include="MySqlConnector" Version="2.0.0" />
-    <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" />
-  </ItemGroup>
-
-  <ItemGroup>
-      <None Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" />
-  </ItemGroup>
-</Project>

+ 0 - 90
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Program.cs

@@ -1,90 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Runtime.InteropServices;
-
-namespace PlatformBenchmarks;
-
-public class Program
-{
-    public static string[] Args;
-
-    public static async Task Main(string[] args)
-    {
-        Args = args;
-
-        Console.WriteLine(BenchmarkApplication.ApplicationName);
-#if !DATABASE
-        Console.WriteLine(BenchmarkApplication.Paths.Plaintext);
-        Console.WriteLine(BenchmarkApplication.Paths.Json);
-#else
-            Console.WriteLine(BenchmarkApplication.Paths.Fortunes);
-            Console.WriteLine(BenchmarkApplication.Paths.SingleQuery);
-            Console.WriteLine(BenchmarkApplication.Paths.Updates);
-            Console.WriteLine(BenchmarkApplication.Paths.MultipleQueries);
-#endif
-        DateHeader.SyncDateTimer();
-
-        var host = BuildWebHost(args);
-        var config = (IConfiguration)host.Services.GetService(typeof(IConfiguration));
-        BatchUpdateString.DatabaseServer = config.Get<AppSettings>().Database;
-#if DATABASE
-            await BenchmarkApplication.Db.PopulateCache();
-#endif
-        await host.RunAsync();
-    }
-
-    public static IWebHost BuildWebHost(string[] args)
-    {
-        var config = new ConfigurationBuilder()
-            .AddJsonFile("appsettings.json")
-            .AddEnvironmentVariables()
-            .AddEnvironmentVariables(prefix: "ASPNETCORE_")
-            .AddCommandLine(args)
-            .Build();
-
-        var appSettings = config.Get<AppSettings>();
-#if DATABASE
-            Console.WriteLine($"Database: {appSettings.Database}");
-            Console.WriteLine($"ConnectionString: {appSettings.ConnectionString}");
-
-            if (appSettings.Database is DatabaseServer.PostgreSql
-                                     or DatabaseServer.MySql)
-            {
-                BenchmarkApplication.Db = new RawDb(new ConcurrentRandom(), appSettings);
-            }
-            else
-            {
-                throw new NotSupportedException($"{appSettings.Database} is not supported");
-            }
-#endif
-
-        var hostBuilder = new WebHostBuilder()
-            .UseBenchmarksConfiguration(config)
-            .UseKestrel((context, options) =>
-            {
-                var endPoint = context.Configuration.CreateIPEndPoint();
-
-                options.Listen(endPoint, builder =>
-                {
-                    builder.UseHttpApplication<BenchmarkApplication>();
-                });
-            })
-            .UseStartup<Startup>();
-
-        hostBuilder.UseSockets(options =>
-        {
-            options.WaitForDataBeforeAllocatingBuffer = false;
-
-            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
-            {
-                options.UnsafePreferInlineScheduling = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS") == "1";
-            }
-        });
-
-
-        var host = hostBuilder.Build();
-
-        return host;
-    }
-}

+ 0 - 11
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Startup.cs

@@ -1,11 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace PlatformBenchmarks;
-
-public class Startup
-{
-    public void Configure(IApplicationBuilder app)
-    {
-    }
-}

+ 0 - 57
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/StringBuilderCache.cs

@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved. 
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
-
-using System.Text;
-
-namespace PlatformBenchmarks;
-
-internal static class StringBuilderCache
-{
-    private const int DefaultCapacity = 1386;
-    private const int MaxBuilderSize = DefaultCapacity * 3;
-
-    [ThreadStatic]
-    private static StringBuilder t_cachedInstance;
-
-    /// <summary>Get a StringBuilder for the specified capacity.</summary>
-    /// <remarks>If a StringBuilder of an appropriate size is cached, it will be returned and the cache emptied.</remarks>
-    public static StringBuilder Acquire(int capacity = DefaultCapacity)
-    {
-        if (capacity <= MaxBuilderSize)
-        {
-            StringBuilder sb = t_cachedInstance;
-            if (capacity < DefaultCapacity)
-            {
-                capacity = DefaultCapacity;
-            }
-
-            if (sb != null)
-            {
-                // Avoid stringbuilder block fragmentation by getting a new StringBuilder
-                // when the requested size is larger than the current capacity
-                if (capacity <= sb.Capacity)
-                {
-                    t_cachedInstance = null;
-                    sb.Clear();
-                    return sb;
-                }
-            }
-        }
-        return new StringBuilder(capacity);
-    }
-
-    public static void Release(StringBuilder sb)
-    {
-        if (sb.Capacity <= MaxBuilderSize)
-        {
-            t_cachedInstance = sb;
-        }
-    }
-
-    public static string GetStringAndRelease(StringBuilder sb)
-    {
-        string result = sb.ToString();
-        Release(sb);
-        return result;
-    }
-}

+ 0 - 3
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.json

@@ -1,3 +0,0 @@
-{
-  "ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=aspnetcore-Benchmarks;Trusted_Connection=True;MultipleActiveResultSets=true"
-}

+ 0 - 4
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.mysql.json

@@ -1,4 +0,0 @@
-{
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=1024;SslMode=None;ConnectionReset=false;ConnectionIdlePingTime=900;ConnectionIdleTimeout=0;AutoEnlist=false;DefaultCommandTimeout=0;ConnectionTimeout=0;IgnorePrepare=false;",
-  "Database": "mysql"
-}

+ 0 - 4
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.postgresql.json

@@ -1,4 +0,0 @@
-{
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
-  "Database": "postgresql"
-}

+ 0 - 4
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/appsettings.postgresql.updates.json

@@ -1,4 +0,0 @@
-{
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=18;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",  
-  "Database": "postgresql"
-}

+ 0 - 28
frameworks/CSharp/aspnetcore-corert/README.md

@@ -1,28 +0,0 @@
-# ASP.NET Core Tests on Windows and Linux
-
-See [.NET CoreRT](https://github.com/dotnet/corert) and [ASP.NET Core](https://github.com/aspnet) for more information.
-
-This includes tests for plaintext and json serialization.
-
-## Infrastructure Software Versions
-
-**Language**
-
-* C# 7.0
-
-**Platforms**
-
-* .NET [CoreRT](https://github.com/dotnet/corert), a .NET Core runtime optimized for AOT (ahead of time compilation), with the accompanying .NET native compiler toolchain
-
-**Web Servers**
-
-* [Kestrel](https://github.com/aspnet/KestrelHttpServer)
-
-**Web Stack**
-
-* ASP.NET Core
-
-## Paths & Source for Tests
-
-* [Plaintext](PlatformBenchmarks/BenchmarkApplication.Plaintext.cs): "/plaintext"
-* [JSON Serialization](PlatformBenchmarks/BenchmarkApplication.Json.cs): "/json"

+ 0 - 16
frameworks/CSharp/aspnetcore-corert/aspcore-corert.dockerfile

@@ -1,16 +0,0 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
-RUN apt-get update
-RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev
-WORKDIR /app
-COPY PlatformBenchmarks .
-RUN dotnet publish -c Release -o out -r linux-x64
-
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
-ENV ASPNETCORE_URLS http://+:8080
-ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
-WORKDIR /app
-COPY --from=build /app/out ./
-
-EXPOSE 8080
-
-ENTRYPOINT ["./PlatformBenchmarks"]

+ 0 - 63
frameworks/CSharp/aspnetcore-corert/benchmark_config.json

@@ -1,63 +0,0 @@
-{
-  "framework": "aspcore-corert",
-  "tests": [{
-    "default": {
-      "plaintext_url": "/plaintext",
-      "json_url": "/json",
-      "port": 8080,
-      "approach": "Stripped",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "ASP.NET Core",
-      "language": "C#",
-      "orm": "Raw",
-      "platform": ".NET",
-      "flavor": "CoreRT",
-      "webserver": "Kestrel",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ASP.NET Core [Platform, CoreRT]",
-      "notes": "",
-      "versus": "aspcore"
-    },
-    "ado-pg": {
-      "fortune_url": "/fortunes",
-      "db_url": "/db",
-      "query_url": "/queries/",
-      "cached_query_url": "/cached-worlds/",
-      "port": 8080,
-      "approach": "Stripped",
-      "classification": "Platform",
-      "database": "Postgres",
-      "framework": "ASP.NET Core",
-      "language": "C#",
-      "orm": "Raw",
-      "platform": ".NET",
-      "flavor": "CoreRT",
-      "webserver": "Kestrel",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ASP.NET Core [Platform, CoreRT, Pg]",
-      "notes": "",
-      "versus": "aspcore-ado-pg"
-    },
-    "ado-pg-up": {
-      "update_url": "/updates/",
-      "port": 8080,
-      "approach": "Stripped",
-      "classification": "Platform",
-      "database": "Postgres",
-      "framework": "ASP.NET Core",
-      "language": "C#",
-      "orm": "Raw",
-      "platform": ".NET",
-      "flavor": "CoreRT",
-      "webserver": "Kestrel",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ASP.NET Core [Platform, CoreRT, Pg]",
-      "notes": "",
-      "versus": "aspcore-ado-pg-up"
-    }
-  }]
-}

+ 0 - 42
frameworks/CSharp/aspnetcore-corert/config.toml

@@ -1,42 +0,0 @@
-[framework]
-name = "aspnetcore-corert"
-
-[ado-pg]
-urls.db = "/db"
-urls.query = "/queries/"
-urls.fortune = "/fortunes"
-urls.cached_query = "/cached-worlds/"
-approach = "Stripped"
-classification = "Platform"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = ".NET"
-webserver = "Kestrel"
-versus = "aspcore-ado-pg"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-approach = "Stripped"
-classification = "Platform"
-database = "None"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = ".NET"
-webserver = "Kestrel"
-versus = "aspcore"
-
-[ado-pg-up]
-urls.update = "/updates/"
-approach = "Stripped"
-classification = "Platform"
-database = "Postgres"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = ".NET"
-webserver = "Kestrel"
-versus = "aspcore-ado-pg-up"

+ 5 - 4
frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj

@@ -1,8 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <ImplicitUsings>enable</ImplicitUsings>
     <ImplicitUsings>enable</ImplicitUsings>
+    <TieredPGO>true</TieredPGO>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
@@ -13,10 +14,10 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
 
 
     <PackageReference Include="Dapper" Version="2.0.123" />
     <PackageReference Include="Dapper" Version="2.0.123" />
-    <PackageReference Include="MySqlConnector" Version="2.0.0" />
-    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
+    <PackageReference Include="MySqlConnector" Version="2.2.0" />
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.0" />
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 0 - 57
frameworks/CSharp/aspnetcore/PlatformBenchmarks/AsciiString.cs

@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Text;
-
-namespace PlatformBenchmarks;
-
-public readonly struct AsciiString : IEquatable<AsciiString>
-{
-    private readonly byte[] _data;
-
-    public AsciiString(string s) => _data = Encoding.ASCII.GetBytes(s);
-
-    private AsciiString(byte[] b) => _data = b;
-
-    public int Length => _data.Length;
-
-    public ReadOnlySpan<byte> AsSpan() => _data;
-
-    public static implicit operator ReadOnlySpan<byte>(AsciiString str) => str._data;
-    public static implicit operator byte[](AsciiString str) => str._data;
-
-    public static implicit operator AsciiString(string str) => new(str);
-
-    public override string ToString() => Encoding.ASCII.GetString(_data);
-    public static explicit operator string(AsciiString str) => str.ToString();
-
-    public bool Equals(AsciiString other) => ReferenceEquals(_data, other._data) || SequenceEqual(_data, other._data);
-    private bool SequenceEqual(byte[] data1, byte[] data2) => new Span<byte>(data1).SequenceEqual(data2);
-
-    public static bool operator ==(AsciiString a, AsciiString b) => a.Equals(b);
-    public static bool operator !=(AsciiString a, AsciiString b) => !a.Equals(b);
-    public override bool Equals(object other) => (other is AsciiString @string) && Equals(@string);
-
-    public static AsciiString operator +(AsciiString a, AsciiString b)
-    {
-        var result = new byte[a.Length + b.Length];
-        a._data.CopyTo(result, 0);
-        b._data.CopyTo(result, a.Length);
-        return new AsciiString(result);
-    }
-
-    public override int GetHashCode()
-    {
-        // Copied from x64 version of string.GetLegacyNonRandomizedHashCode()
-        // https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/String.Comparison.cs
-        var data = _data;
-        int hash1 = 5381;
-        int hash2 = hash1;
-        foreach (int b in data)
-        {
-            hash1 = ((hash1 << 5) + hash1) ^ b;
-        }
-        return hash1 + (hash2 * 1566083941);
-    }
-
-}

+ 5 - 5
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Fortunes.cs

@@ -12,11 +12,11 @@ namespace PlatformBenchmarks
 {
 {
     public partial class BenchmarkApplication
     public partial class BenchmarkApplication
     {
     {
-        private readonly static AsciiString _fortunesPreamble =
-            _http11OK +
-            _headerServer + _crlf +
-            _headerContentTypeHtml + _crlf +
-            _headerContentLength;
+        private static ReadOnlySpan<byte> _fortunesPreamble =>
+            "HTTP/1.1 200 OK\r\n"u8 +
+            "Server: K\r\n"u8 +
+            "Content-Type: text/html; charset=UTF-8\r\n"u8 +
+            "Content-Length: "u8;
 
 
         private async Task Fortunes(PipeWriter pipeWriter)
         private async Task Fortunes(PipeWriter pipeWriter)
         {
         {

+ 5 - 5
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Json.cs

@@ -10,11 +10,11 @@ public partial class BenchmarkApplication
 {
 {
     private readonly static uint _jsonPayloadSize = (uint)JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage).Length;
     private readonly static uint _jsonPayloadSize = (uint)JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerContext.JsonMessage).Length;
 
 
-    private readonly static AsciiString _jsonPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeJson + _crlf +
-        _headerContentLength + _jsonPayloadSize.ToString();
+    private static ReadOnlySpan<byte> _jsonPreamble =>
+        "HTTP/1.1 200 OK\r\n"u8 +
+        "Server: K\r\n"u8 +
+        "Content-Type: application/json\r\n"u8 +
+        "Content-Length: 27"u8;
 
 
     private static void Json(ref BufferWriter<WriterAdapter> writer, IBufferWriter<byte> bodyWriter)
     private static void Json(ref BufferWriter<WriterAdapter> writer, IBufferWriter<byte> bodyWriter)
     {
     {

+ 5 - 5
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.Plaintext.cs

@@ -5,11 +5,11 @@ namespace PlatformBenchmarks;
 
 
 public partial class BenchmarkApplication
 public partial class BenchmarkApplication
 {
 {
-    private readonly static AsciiString _plaintextPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeText + _crlf +
-        _headerContentLength + _plainTextBody.Length.ToString();
+    private static ReadOnlySpan<byte> _plaintextPreamble =>
+        "HTTP/1.1 200 OK\r\n"u8 +
+        "Server: K\r\n"u8 +
+        "Content-Type: text/plain\r\n"u8 +
+        "Content-Length: 13"u8;
 
 
     private static void PlainText(ref BufferWriter<WriterAdapter> writer)
     private static void PlainText(ref BufferWriter<WriterAdapter> writer)
     {
     {

+ 39 - 40
frameworks/CSharp/aspnetcore/PlatformBenchmarks/BenchmarkApplication.cs

@@ -12,29 +12,28 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
 
 
 namespace PlatformBenchmarks;
 namespace PlatformBenchmarks;
 
 
-public partial class BenchmarkApplication
+public sealed partial class BenchmarkApplication
 {
 {
-    private readonly static AsciiString _applicationName = "Kestrel Platform-Level Application";
-    public static AsciiString ApplicationName => _applicationName;
-
-    private readonly static AsciiString _crlf = "\r\n";
-    private readonly static AsciiString _eoh = "\r\n\r\n"; // End Of Headers
-    private readonly static AsciiString _http11OK = "HTTP/1.1 200 OK\r\n";
-    private readonly static AsciiString _http11NotFound = "HTTP/1.1 404 Not Found\r\n";
-    private readonly static AsciiString _headerServer = "Server: K";
-    private readonly static AsciiString _headerContentLength = "Content-Length: ";
-    private readonly static AsciiString _headerContentLengthZero = "Content-Length: 0";
-    private readonly static AsciiString _headerContentTypeText = "Content-Type: text/plain";
-    private readonly static AsciiString _headerContentTypeJson = "Content-Type: application/json";
-    private readonly static AsciiString _headerContentTypeHtml = "Content-Type: text/html; charset=UTF-8";
-
-    private readonly static AsciiString _dbPreamble =
-        _http11OK +
-        _headerServer + _crlf +
-        _headerContentTypeJson + _crlf +
-        _headerContentLength;
-
-    private readonly static AsciiString _plainTextBody = "Hello, World!";
+    public static ReadOnlySpan<byte> ApplicationName => "Kestrel Platform-Level Application"u8;
+
+    private static ReadOnlySpan<byte> _crlf => "\r\n"u8;
+    private static ReadOnlySpan<byte> _eoh => "\r\n\r\n"u8; // End Of Headers
+    private static ReadOnlySpan<byte> _http11OK => "HTTP/1.1 200 OK\r\n"u8;
+    private static ReadOnlySpan<byte> _http11NotFound => "HTTP/1.1 404 Not Found\r\n"u8;
+    private static ReadOnlySpan<byte> _headerServer => "Server: K"u8;
+    private static ReadOnlySpan<byte> _headerContentLength => "Content-Length: "u8;
+    private static ReadOnlySpan<byte> _headerContentLengthZero => "Content-Length: 0"u8;
+    private static ReadOnlySpan<byte> _headerContentTypeText => "Content-Type: text/plain"u8;
+    private static ReadOnlySpan<byte> _headerContentTypeJson => "Content-Type: application/json"u8;
+    private static ReadOnlySpan<byte> _headerContentTypeHtml => "Content-Type: text/html; charset=UTF-8"u8;
+
+    private static ReadOnlySpan<byte> _dbPreamble => 
+        "HTTP/1.1 200 OK\r\n"u8 +
+        "Server: K\r\n"u8 +
+        "Content-Type: application/json\r\n"u8 +
+        "Content-Length: "u8;
+
+    private static ReadOnlySpan<byte> _plainTextBody => "Hello, World!"u8;
 
 
     private static readonly JsonContext SerializerContext = JsonContext.Default;
     private static readonly JsonContext SerializerContext = JsonContext.Default;
 
 
@@ -46,12 +45,12 @@ public partial class BenchmarkApplication
     {
     {
     }
     }
 
 
-    private readonly static AsciiString _fortunesTableStart = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
-    private readonly static AsciiString _fortunesRowStart = "<tr><td>";
-    private readonly static AsciiString _fortunesColumn = "</td><td>";
-    private readonly static AsciiString _fortunesRowEnd = "</td></tr>";
-    private readonly static AsciiString _fortunesTableEnd = "</table></body></html>";
-    private readonly static AsciiString _contentLengthGap = new string(' ', 4);
+    private static ReadOnlySpan<byte> _fortunesTableStart => "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>"u8;
+    private static ReadOnlySpan<byte> _fortunesRowStart => "<tr><td>"u8;
+    private static ReadOnlySpan<byte> _fortunesColumn => "</td><td>"u8;
+    private static ReadOnlySpan<byte> _fortunesRowEnd => "</td></tr>"u8;
+    private static ReadOnlySpan<byte> _fortunesTableEnd => "</table></body></html>"u8;
+    private static ReadOnlySpan<byte> _contentLengthGap => "    "u8;
 
 
 #if DATABASE
 #if DATABASE
         public static RawDb Db { get; set; }
         public static RawDb Db { get; set; }
@@ -62,13 +61,13 @@ public partial class BenchmarkApplication
 
 
     public static class Paths
     public static class Paths
     {
     {
-        public readonly static AsciiString Json = "/json";
-        public readonly static AsciiString Plaintext = "/plaintext";
-        public readonly static AsciiString SingleQuery = "/db";
-        public readonly static AsciiString Fortunes = "/fortunes";
-        public readonly static AsciiString Updates = "/updates/";
-        public readonly static AsciiString MultipleQueries = "/queries/";
-        public readonly static AsciiString Caching = "/cached-worlds/";
+        public static ReadOnlySpan<byte> Json => "/json"u8;
+        public static ReadOnlySpan<byte> Plaintext => "/plaintext"u8;
+        public static ReadOnlySpan<byte> SingleQuery => "/db"u8;
+        public static ReadOnlySpan<byte> Fortunes => "/fortunes"u8;
+        public static ReadOnlySpan<byte> Updates => "/updates/"u8;
+        public static ReadOnlySpan<byte> MultipleQueries => "/queries/"u8;
+        public static ReadOnlySpan<byte> Caching => "/cached-worlds/"u8;
     }
     }
 
 
     private RequestType _requestType;
     private RequestType _requestType;
@@ -169,11 +168,11 @@ public partial class BenchmarkApplication
             return Task.CompletedTask;
             return Task.CompletedTask;
         }
         }
 #endif
 #endif
-    private readonly static AsciiString _defaultPreamble =
-        _http11NotFound +
-        _headerServer + _crlf +
-        _headerContentTypeText + _crlf +
-        _headerContentLengthZero;
+    private static ReadOnlySpan<byte> _defaultPreamble =>
+        "HTTP/1.1 200 OK\r\n"u8 +
+        "Server: K"u8 + "\r\n"u8 +
+        "Content-Type: text/plain"u8 +
+        "Content-Length: 0"u8;
 
 
     private static void Default(ref BufferWriter<WriterAdapter> writer)
     private static void Default(ref BufferWriter<WriterAdapter> writer)
     {
     {

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/BatchUpdateString.cs

@@ -3,7 +3,7 @@
 
 
 namespace PlatformBenchmarks;
 namespace PlatformBenchmarks;
 
 
-internal class BatchUpdateString
+internal sealed class BatchUpdateString
 {
 {
     private const int MaxBatch = 500;
     private const int MaxBatch = 500;
 
 

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/CachedWorld.cs

@@ -9,5 +9,5 @@ public sealed class CachedWorld
 
 
     public int RandomNumber { get; set; }
     public int RandomNumber { get; set; }
 
 
-    public static implicit operator CachedWorld(World world) => new CachedWorld { Id = world.Id, RandomNumber = world.RandomNumber };
+    public static implicit operator CachedWorld(World world) => new() { Id = world.Id, RandomNumber = world.RandomNumber };
 }
 }

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbMySqlConnector.cs

@@ -15,7 +15,7 @@ namespace PlatformBenchmarks
 {
 {
     // Is semantically identical to RawDbNpgsql.cs.
     // Is semantically identical to RawDbNpgsql.cs.
     // If you are changing RawDbMySqlConnector.cs, also consider changing RawDbNpgsql.cs.
     // If you are changing RawDbMySqlConnector.cs, also consider changing RawDbNpgsql.cs.
-    public class RawDb
+    public sealed class RawDb
     {
     {
         private readonly ConcurrentRandom _random;
         private readonly ConcurrentRandom _random;
         private readonly string _connectionString;
         private readonly string _connectionString;

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Providers/RawDbNpgsql.cs

@@ -15,7 +15,7 @@ namespace PlatformBenchmarks
 {
 {
     // Is semantically identical to RawDbMySqlConnector.cs.
     // Is semantically identical to RawDbMySqlConnector.cs.
     // If you are changing RawDbNpgsql.cs, also consider changing RawDbMySqlConnector.cs.
     // If you are changing RawDbNpgsql.cs, also consider changing RawDbMySqlConnector.cs.
-    public class RawDb
+    public sealed class RawDb
     {
     {
         private readonly ConcurrentRandom _random;
         private readonly ConcurrentRandom _random;
         private readonly string _connectionString;
         private readonly string _connectionString;

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Data/Random.cs

@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
 
 
 namespace PlatformBenchmarks;
 namespace PlatformBenchmarks;
 
 
-public class ConcurrentRandom
+public sealed class ConcurrentRandom
 {
 {
     private static int nextSeed = 0;
     private static int nextSeed = 0;
 
 

+ 2 - 4
frameworks/CSharp/aspnetcore/PlatformBenchmarks/DateHeader.cs

@@ -27,7 +27,7 @@ internal static class DateHeader
 
 
     static DateHeader()
     static DateHeader()
     {
     {
-        var utf8 = Encoding.ASCII.GetBytes("\r\nDate: ").AsSpan();
+        var utf8 = "\r\nDate: "u8;
 
 
         utf8.CopyTo(s_headerBytesMaster);
         utf8.CopyTo(s_headerBytesMaster);
         utf8.CopyTo(s_headerBytesScratch);
         utf8.CopyTo(s_headerBytesScratch);
@@ -57,9 +57,7 @@ internal static class DateHeader
                 throw new Exception("date time format failed");
                 throw new Exception("date time format failed");
             }
             }
             Debug.Assert(written == dateTimeRLength);
             Debug.Assert(written == dateTimeRLength);
-            var temp = s_headerBytesMaster;
-            s_headerBytesMaster = s_headerBytesScratch;
-            s_headerBytesScratch = temp;
+            (s_headerBytesScratch, s_headerBytesMaster) = (s_headerBytesMaster, s_headerBytesScratch);
         }
         }
     }
     }
 }
 }

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/HttpApplication.cs

@@ -14,7 +14,7 @@ public static class HttpApplicationConnectionBuilderExtensions
     }
     }
 }
 }
 
 
-public class HttpApplication<TConnection> where TConnection : IHttpConnection, new()
+public sealed class HttpApplication<TConnection> where TConnection : IHttpConnection, new()
 {
 {
     public Task ExecuteAsync(ConnectionContext connection)
     public Task ExecuteAsync(ConnectionContext connection)
     {
     {

+ 9 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -1,9 +1,17 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <ImplicitUsings>enable</ImplicitUsings>
     <ImplicitUsings>enable</ImplicitUsings>
+
+    <!-- Settings applicable to JIT-based deployment -->
+    <TieredPGO>true</TieredPGO>
+
+    <!-- Settings applicable to AOT-based deployment -->
+    <StripSymbols>true</StripSymbols>
+    <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
+    <IlcPgoOptimize>true</IlcPgoOptimize>
   </PropertyGroup>
   </PropertyGroup>
   
   
   <PropertyGroup>
   <PropertyGroup>

+ 9 - 8
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Program.cs

@@ -2,10 +2,11 @@
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
+using System.Text;
 
 
 namespace PlatformBenchmarks;
 namespace PlatformBenchmarks;
 
 
-public class Program
+public sealed class Program
 {
 {
     public static string[] Args;
     public static string[] Args;
 
 
@@ -13,15 +14,15 @@ public class Program
     {
     {
         Args = args;
         Args = args;
 
 
-        Console.WriteLine(BenchmarkApplication.ApplicationName);
+        Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.ApplicationName));
 #if !DATABASE
 #if !DATABASE
-        Console.WriteLine(BenchmarkApplication.Paths.Plaintext);
-        Console.WriteLine(BenchmarkApplication.Paths.Json);
+        Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.Plaintext));
+        Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.Json));
 #else
 #else
-            Console.WriteLine(BenchmarkApplication.Paths.Fortunes);
-            Console.WriteLine(BenchmarkApplication.Paths.SingleQuery);
-            Console.WriteLine(BenchmarkApplication.Paths.Updates);
-            Console.WriteLine(BenchmarkApplication.Paths.MultipleQueries);
+            Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.Fortunes));
+            Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.SingleQuery));
+            Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.Updates));
+            Console.WriteLine(Encoding.UTF8.GetString(BenchmarkApplication.Paths.MultipleQueries));
 #endif
 #endif
         DateHeader.SyncDateTimer();
         DateHeader.SyncDateTimer();
 
 

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Startup.cs

@@ -3,7 +3,7 @@
 
 
 namespace PlatformBenchmarks;
 namespace PlatformBenchmarks;
 
 
-public class Startup
+public sealed class Startup
 {
 {
     public void Configure(IApplicationBuilder app)
     public void Configure(IApplicationBuilder app)
     {
     {

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-my.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-pg-up.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-ado-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 4 - 4
frameworks/CSharp/aspnetcore-corert/aspcore-corert-ado-pg-up.dockerfile → frameworks/CSharp/aspnetcore/aspcore-aot-ado-pg-up.dockerfile

@@ -1,11 +1,11 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 RUN apt-get update
 RUN apt-get update
-RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev
+RUN apt-get -yqq install clang zlib1g-dev
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
-RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql -r linux-x64
+RUN dotnet publish -c Release -o out -p:PublishAot=true -p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 WORKDIR /app
 WORKDIR /app

+ 4 - 4
frameworks/CSharp/aspnetcore-corert/aspcore-corert-ado-pg.dockerfile → frameworks/CSharp/aspnetcore/aspcore-aot-ado-pg.dockerfile

@@ -1,11 +1,11 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 RUN apt-get update
 RUN apt-get update
-RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev
+RUN apt-get -yqq install clang zlib1g-dev
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
-RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql -r linux-x64
+RUN dotnet publish -c Release -o out -p:PublishAot=true -p:DatabaseProvider=Npgsql
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 WORKDIR /app
 WORKDIR /app

+ 18 - 0
frameworks/CSharp/aspnetcore/aspcore-aot.dockerfile

@@ -0,0 +1,18 @@
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
+RUN apt-get update
+RUN apt-get -yqq install clang zlib1g-dev
+WORKDIR /app
+COPY PlatformBenchmarks .
+RUN dotnet publish -c Release -o out -p:PublishAot=true
+
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
+ENV ASPNETCORE_URLS http://+:8080
+ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
+
+WORKDIR /app
+COPY --from=build /app/out ./
+COPY Benchmarks/appsettings.json ./appsettings.json
+
+EXPOSE 8080
+
+ENTRYPOINT ["./PlatformBenchmarks"]

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-my.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg-up.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ado-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-my.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg-up.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-dap-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc-ef-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mvc.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-my.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg-up.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ado-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-my.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg-up.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-dap-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-ef-pg.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw-json.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore-mw.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 
 
 # Full PGO
 # Full PGO

+ 2 - 2
frameworks/CSharp/aspnetcore/aspcore.dockerfile

@@ -1,9 +1,9 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
+FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out
 
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:7.0.0 AS runtime
 ENV ASPNETCORE_URLS http://+:8080
 ENV ASPNETCORE_URLS http://+:8080
 ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
 ENV DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS 1
 
 

+ 58 - 0
frameworks/CSharp/aspnetcore/benchmark_config.json

@@ -20,6 +20,25 @@
       "notes": "",
       "notes": "",
       "versus": "aspcore"
       "versus": "aspcore"
     },
     },
+    "aot": {
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Stripped",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "ASP.NET Core",
+      "language": "C#",
+      "orm": "Raw",
+      "platform": ".NET",
+      "flavor": "NativeAOT",
+      "webserver": "Kestrel",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ASP.NET Core [Platform, NativeAOT]",
+      "notes": "",
+      "versus": "aspcore-aot"
+    },
     "ado-pg": {
     "ado-pg": {
       "fortune_url": "/fortunes",
       "fortune_url": "/fortunes",
       "db_url": "/db",
       "db_url": "/db",
@@ -41,6 +60,27 @@
       "notes": "",
       "notes": "",
       "versus": "aspcore-ado-pg"
       "versus": "aspcore-ado-pg"
     },
     },
+    "aot-ado-pg": {
+      "fortune_url": "/fortunes",
+      "db_url": "/db",
+      "query_url": "/queries/",
+      "cached_query_url": "/cached-worlds/",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "Postgres",
+      "framework": "ASP.NET Core",
+      "language": "C#",
+      "orm": "Raw",
+      "platform": ".NET",
+      "flavor": "NativeAOT",
+      "webserver": "Kestrel",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ASP.NET Core [Platform, NativeAOT, Pg]",
+      "notes": "",
+      "versus": "aspcore-aot-ado-pg"
+    },
     "ado-pg-up": {
     "ado-pg-up": {
       "update_url": "/updates/",
       "update_url": "/updates/",
       "port": 8080,
       "port": 8080,
@@ -59,6 +99,24 @@
       "notes": "",
       "notes": "",
       "versus": "aspcore-ado-pg-up"
       "versus": "aspcore-ado-pg-up"
     },
     },
+    "aot-ado-pg-up": {
+      "update_url": "/updates/",
+      "port": 8080,
+      "approach": "Stripped",
+      "classification": "Platform",
+      "database": "Postgres",
+      "framework": "ASP.NET Core",
+      "language": "C#",
+      "orm": "Raw",
+      "platform": ".NET",
+      "flavor": "NativeAOT",
+      "webserver": "Kestrel",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ASP.NET Core [Platform, NativeAOT, Pg]",
+      "notes": "",
+      "versus": "aspcore-aot-ado-pg-up"
+    },
     "mw": {
     "mw": {
       "plaintext_url": "/plaintext",
       "plaintext_url": "/plaintext",
       "port": 8080,
       "port": 8080,

+ 40 - 0
frameworks/CSharp/aspnetcore/config.toml

@@ -16,6 +16,21 @@ platform = ".NET"
 webserver = "Kestrel"
 webserver = "Kestrel"
 versus = "aspcore-ado-pg"
 versus = "aspcore-ado-pg"
 
 
+[aot-ado-pg]
+urls.db = "/db"
+urls.query = "/queries/"
+urls.fortune = "/fortunes"
+urls.cached_query = "/cached-worlds/"
+approach = "Stripped"
+classification = "Platform"
+database = "Postgres"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = ".NET"
+webserver = "Kestrel"
+versus = "aspcore-aot-ado-pg"
+
 [ado-my]
 [ado-my]
 urls.db = "/db"
 urls.db = "/db"
 urls.query = "/queries/"
 urls.query = "/queries/"
@@ -262,6 +277,19 @@ platform = ".NET"
 webserver = "Kestrel"
 webserver = "Kestrel"
 versus = "aspcore"
 versus = "aspcore"
 
 
+[aot]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Stripped"
+classification = "Platform"
+database = "None"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = ".NET"
+webserver = "Kestrel"
+versus = "aspcore-aot"
+
 [mvc-dap-pg-up]
 [mvc-dap-pg-up]
 urls.update = "/mvc/updates/dapper?queries="
 urls.update = "/mvc/updates/dapper?queries="
 approach = "Realistic"
 approach = "Realistic"
@@ -309,3 +337,15 @@ orm = "Raw"
 platform = ".NET"
 platform = ".NET"
 webserver = "Kestrel"
 webserver = "Kestrel"
 versus = "aspcore-ado-pg-up"
 versus = "aspcore-ado-pg-up"
+
+[aot-ado-pg-up]
+urls.update = "/updates/"
+approach = "Stripped"
+classification = "Platform"
+database = "Postgres"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = ".NET"
+webserver = "Kestrel"
+versus = "aspcore-ado-pg-up"