-
What Configure Kestrel endpoints explicitly (ports, HTTPS, HTTP/2/HTTP/3), and disable protocols you don’t need.
-
Why
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Diagnostics; | |
| using System.Net.Http.Json; | |
| using Grpc.Net.Client; | |
| using RpcPerfDemo.Grpc; | |
| // Simple POCO matching REST response shape | |
| public class RestPerfResponse | |
| { | |
| public int Id { get; set; } | |
| public string Name { get; set; } = string.Empty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Threading.Tasks; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| const int iterations = 5_000_000; // how many times we call the async API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Diagnostics; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| const int itemCount = 500_000; // number of strings to process | |
| Console.WriteLine("========================================="); | |
| Console.WriteLine(" Span<T> Demo – Substring vs Span "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Buffers; | |
| using System.Diagnostics; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| const int iterations = 1_000_000; // Total loop count for the main test | |
| const int bufferSize = 1024; // Size of the byte[] buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Order; | |
| using System; | |
| using System.Runtime.CompilerServices; | |
| using System.Threading.Tasks; | |
| namespace BenchmarkDotNetLab | |
| { | |
| [MemoryDiagnoser] | |
| [Orderer(SummaryOrderPolicy.FastestToSlowest)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Order; | |
| using System; | |
| using System.Text; | |
| namespace BenchmarkDotNetLab | |
| { | |
| [MemoryDiagnoser] | |
| [Orderer(SummaryOrderPolicy.FastestToSlowest)] | |
| [RankColumn] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Order; | |
| using System; | |
| using System.Text; | |
| namespace BenchmarkDotNetLab | |
| { | |
| [MemoryDiagnoser] | |
| [Orderer(SummaryOrderPolicy.FastestToSlowest)] | |
| [RankColumn] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Order; | |
| using System; | |
| using System.Linq; | |
| namespace BenchmarkDotNetLab | |
| { | |
| [MemoryDiagnoser] | |
| [Orderer(SummaryOrderPolicy.FastestToSlowest)] | |
| [RankColumn] |
NewerOlder