https://github.com/codebeltnet/benchmarkdotnet
This library provides a uniform way of benchmarking your projects with BenchmarkDotNet.
https://github.com/codebeltnet/benchmarkdotnet
Last synced: 4 months ago
JSON representation
This library provides a uniform way of benchmarking your projects with BenchmarkDotNet.
- Host: GitHub
- URL: https://github.com/codebeltnet/benchmarkdotnet
- Owner: codebeltnet
- License: mit
- Created: 2025-11-29T19:15:00.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-14T19:06:59.000Z (6 months ago)
- Last Synced: 2025-12-17T04:57:25.219Z (6 months ago)
- Language: C#
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README

# Extensions for BenchmarkDotNet API by Codebelt
[](https://github.com/codebeltnet/benchmarkdotnet/actions/workflows/ci-pipeline.yml)[](https://codecov.io/gh/codebeltnet/benchmarkdotnet) [](https://sonarcloud.io/dashboard?id=benchmarkdotnet) [](https://sonarcloud.io/dashboard?id=benchmarkdotnet) [](https://sonarcloud.io/dashboard?id=benchmarkdotnet) [](https://sonarcloud.io/dashboard?id=benchmarkdotnet) [](https://scorecard.dev/viewer/?uri=github.com/codebeltnet/benchmarkdotnet)
An open-source project (MIT license) that targets and complements the [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) performance library. It provides a uniform and convenient way of doing benchmarking for all project types in .NET.
Your versatile BenchmarkDotNet companion for modern development with `.NET 9` and `.NET 10`.
It is, by heart, free, flexible and built to extend and boost your agile codebelt.
## Concept
The Extensions for BenchmarkDotNet API by Codebelt is designed to bring clarity, structure, and consistency to BenchmarkDotNet projects.
### Folder Structure
The folder structure promoted by **Codebelt.Extensions.BenchmarkDotNet** follows the same architectural principles commonly used for test projects—while remaining purpose-built for benchmarking.
At the solution level, benchmarks are treated as a first-class concern, clearly separated from tooling and output artifacts.
- **tuning** contains all benchmark projects (e.g. `*.Benchmarks`), in the same way that a `test` folder typically contains `*.Tests` projects,
- **tooling** hosts the executable console application responsible for discovering and running benchmarks,
- **reports** captures benchmark results and generated artifacts, separated from source code and tooling concerns.
This separation enforces a clean boundary between benchmark definition, execution, and output, making benchmark suites easier to scale, automate, and reason about.
### Layout Example
```text
Repository Root
│
├─ reports
│ └─ tuning
│ └─ github
│ └─ MyLibrary.ExampleBenchmarks-report-github.md
│
├─ src
│ └─ MyLibrary
│
├─ test
│ └─ MyLibrary.Tests
│ └─ ExampleTest.cs
│
├─ tooling
│ └─ benchmark-runner
│ └─ Program.cs
│
└─ tuning
└─ MyLibrary.Benchmarks
└─ ExampleBenchmark.cs
```
### Codebelt.Extensions.BenchmarkDotNet.Console Example
Benchmarks are executed through a console-hosted Generic Host, allowing full participation in dependency injection, configuration, logging and more.
```csharp
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));
});
});
}
}
```
## 📚 Documentation
Full documentation (generated by [DocFx](https://github.com/dotnet/docfx)) located here: https://benchmarkdotnet.codebelt.net/
## 📦 Standalone Packages
Provides a focused API for BenchmarkDotNet projects.
|Package|vNext|Stable|Downloads|
|:--|:-:|:-:|:-:|
| [Codebelt.Extensions.BenchmarkDotNet](https://www.nuget.org/packages/Codebelt.Extensions.BenchmarkDotNet/) |  |  |  |
| [Codebelt.Extensions.BenchmarkDotNet.Console](https://www.nuget.org/packages/Codebelt.Extensions.BenchmarkDotNet.Console/) |  |  |  |
### Contributing to `Extensions for BenchmarkDotNet API by Codebelt`
[Contributions](.github/CONTRIBUTING.md) are welcome and appreciated.
Feel free to submit issues, feature requests, or pull requests to help improve this library.
### License
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.