PowerUtils.BenchmarkDotnet.Reporter is a powerful command-line tool designed to analyze and compare .NET benchmark reports generated by BenchmarkDotNet. This tool provides a simple and effective way to visualize and compare benchmark results, making it ideal for both local development and CI/CD pipeline integration.
Key Features:
- Benchmark Comparison: Compare baseline and target benchmark reports to identify performance regressions or improvements with detailed analysis.
- Multiple Output Formats: Generate reports in various formats including console output, JSON, Markdown, and hit-txt for different use cases.
- Threshold Management: Set performance thresholds for mean execution time and memory allocation to catch performance degradations early.
- CI/CD Integration: Built-in support for automated quality gates with configurable exit codes for warnings and threshold violations.
- Flexible Installation: Available as both a global and local .NET tool for seamless integration into any development workflow.
Installation & Usage:
The tool can be installed globally or locally using the .NET CLI:
# Global installation
dotnet tool install --global PowerUtils.BenchmarkDotnet.Reporter
# Local installation (with tool manifest)
dotnet new tool-manifest
dotnet tool install PowerUtils.BenchmarkDotnet.Reporter
Compare Command:
# Basic comparison
pbreporter compare -b baseline-full.json -t target-full.json
# With thresholds and multiple output formats
pbreporter compare -b baseline-full.json -t target-full.json -tm 5% -ta 12b -f json -f markdown
# CI/CD integration with error handling
pbreporter compare -b baseline-full.json -t target-full.json -tm 5% -fw -ft
Error Handling:
- Exit code 0: Success - No issues detected
- Exit code 1: Warnings detected (when
--fail-on-warnings
is enabled) - Exit code 2: Performance thresholds exceeded (when
--fail-on-threshold-hit
is enabled)
GitHub Actions Integration:
The tool includes comprehensive documentation for GitHub Actions setup, making it easy to integrate benchmark comparison into your CI/CD workflows for automated performance monitoring.
This tool was inspired by the ResultsComparer tool from the .NET performance repository and is available under the MIT license, encouraging community use and contribution.