Sets of benchmarks for .NET Framework, .NET Core, and .NET implemented using BenchmarkDotNet.
The main goal of this project is to measure relative performance of different ways of producing the same result on different .NET implementations/versions.
For instance, the following two methods produce the same result, but using different approaches:
[Benchmark(Baseline = true)]
public string ConcatenateValues()
=> "Timeout, ms: " + Timeout
+ ", URL: " + Url
+ ", Request ID: " + RequestId
+ ", Timestamp: " + Timestamp
+ ", Result: " + Result;
[Benchmark]
public string FormatValuesUsingStringFormatMethod()
//// ReSharper disable once UseStringInterpolation
=> string.Format(
@"Timeout, ms: {0}, URL: {1}, Request ID: {2}, Timestamp: {3}, Result: {4}",
Timeout,
Url,
RequestId,
Timestamp,
Result);
Benchmark Set | Benchmarks | Description |
---|---|---|
StringFormatting |
|
Compares various ways of building a string from string literals and variables. |
- Required Components
- .NET Framework 4.8 SDK (Targeting pack) and Runtime
- .NET Core 2.1 SDK and Runtime
- .NET Core 3.1 SDK and Runtime
- .NET 5 SDK and Runtime
- Optional Components
- Windows PowerShell 5+ and/or PowerShell Core 6+
Parameter | Description |
---|---|
-Clean |
Delete the output directories before the build (if exist). |
-NoBenchmarking |
Do not run benchmarks. |
Run the following command:
& ./run.ps1 [-Clean] [-NoBenchmarking]
Run the following command:
run.cmd [-Clean] [-NoBenchmarking]
NOTE: run.cmd
invokes run.ps1
using Windows PowerShell.
NOTE: Not tested yet.
Run the following command:
& ./run.ps1 [-Clean] [-NoBenchmarking]