Codebelt.Extensions.BenchmarkDotNet.Console
1.2.0
dotnet add package Codebelt.Extensions.BenchmarkDotNet.Console --version 1.2.0
NuGet\Install-Package Codebelt.Extensions.BenchmarkDotNet.Console -Version 1.2.0
<PackageReference Include="Codebelt.Extensions.BenchmarkDotNet.Console" Version="1.2.0" />
<PackageVersion Include="Codebelt.Extensions.BenchmarkDotNet.Console" Version="1.2.0" />
<PackageReference Include="Codebelt.Extensions.BenchmarkDotNet.Console" />
paket add Codebelt.Extensions.BenchmarkDotNet.Console --version 1.2.0
#r "nuget: Codebelt.Extensions.BenchmarkDotNet.Console, 1.2.0"
#:package Codebelt.Extensions.BenchmarkDotNet.Console@1.2.0
#addin nuget:?package=Codebelt.Extensions.BenchmarkDotNet.Console&version=1.2.0
#tool nuget:?package=Codebelt.Extensions.BenchmarkDotNet.Console&version=1.2.0
Codebelt.Extensions.BenchmarkDotNet.Console
A structured, host-based execution model for running BenchmarkDotNet benchmarks in console applications.
About
Codebelt.Extensions.BenchmarkDotNet.Console extends the Codebelt.Extensions.BenchmarkDotNet package with a dedicated console runner built on the Microsoft Generic Host.
It provides a predictable startup model, consistent dependency injection, and a managed application lifecycle for benchmark execution, aligning benchmarks with the same hosting principles used in modern .NET applications.
By embracing Microsoft.Extensions.Hosting, this package enables clean separation between benchmark definition, configuration, and execution - making benchmarks easier to compose, test, and evolve over time.
At its core, the package favors convention over configuration and promotes benchmarks as first-class, host-managed workloads rather than ad-hoc console routines.
CSharp Example
Benchmarks are executed through a console-hosted Generic Host, allowing full participation in dependency injection, configuration, logging and more.
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using Codebelt.Extensions.BenchmarkDotNet.Console;
public class Program
{
public static void Main(string[] args)
{
BenchmarkProgram.Run(args, o =>
{
o.AllowDebugBuild = BenchmarkProgram.IsDebugBuild;
o.ConfigureBenchmarkDotNet(c =>
{
var slimJob = BenchmarkWorkspaceOptions.Slim;
return c.AddJob(slimJob.WithRuntime(CoreRuntime.Core90))
.AddJob(slimJob.WithRuntime(CoreRuntime.Core10_0));
});
});
}
}
Related Packages
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Codebelt.Bootstrapper.Console (>= 5.0.2)
- Codebelt.Extensions.BenchmarkDotNet (>= 1.2.0)
-
net9.0
- Codebelt.Bootstrapper.Console (>= 5.0.2)
- Codebelt.Extensions.BenchmarkDotNet (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version: 1.2.0
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
# Breaking Changes
- REMOVED BenchmarkWorker class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace and functionality has been merged into the BenchmarkProgram class to streamline the hosting and execution of benchmarks
Version: 1.1.0
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
# Improvements
- EXTENDED BenchmarkProgram class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace to support an optional service configurator delegate for customizing the IServiceCollection during host building
- EXTENDED BenchmarkWorker class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace to support skipping benchmarks that already have generated reports based on the BenchmarkWorkspaceOptions.SkipBenchmarksWithReports property
- CHANGED BenchmarkWorker class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace to conditionally suppress console status messages in services based on whether you are in a debugging session or not
Version: 1.0.0
Availability: .NET 10 and .NET 9
# New Features
- ADDED BenchmarkContext class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that represents the command-line context for a benchmark run
- ADDED BenchmarkProgram class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that provides the main entry point for hosting and running benchmarks using BenchmarkDotNet
- ADDED BenchmarkWorker class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that is responsible for executing benchmarks within the console host