Enterprize1.BenchmarkDotNet.GitCompare 0.0.1

dotnet add package Enterprize1.BenchmarkDotNet.GitCompare --version 0.0.1                
NuGet\Install-Package Enterprize1.BenchmarkDotNet.GitCompare -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Enterprize1.BenchmarkDotNet.GitCompare" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Enterprize1.BenchmarkDotNet.GitCompare --version 0.0.1                
#r "nuget: Enterprize1.BenchmarkDotNet.GitCompare, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Enterprize1.BenchmarkDotNet.GitCompare as a Cake Addin
#addin nuget:?package=Enterprize1.BenchmarkDotNet.GitCompare&version=0.0.1

// Install Enterprize1.BenchmarkDotNet.GitCompare as a Cake Tool
#tool nuget:?package=Enterprize1.BenchmarkDotNet.GitCompare&version=0.0.1                

GitCompare for BenchmarkDotNet

Overview

GitCompare for BenchmarkDotNet is an extension package for BenchmarkDotNet that allows developers to compare benchmarks across different git references (e.g., commits, branches, tags). This enables you to track the performance impact of code changes over time.

Installation

To install the package, add it to your project via NuGet:

dotnet add package Enterprize1.BenchmarkDotNet.GitCompare

Getting Started

To use BenchmarkComparison, you will need to set up your benchmark project with BenchmarkDotNet and then add a new Job for a different git reference.

Example (Attribute-Based)

using BenchmarkDotNet_GitCompare;
using BenchmarkDotNet.Attributes;

[SimpleJob(id: "now")]
[GitJob(gitReference: "HEAD", id: "before", baseline: true)]
[MemoryDiagnoser]
public class Bench
{
    [Benchmark]
    public Task Test()
    {
        return Task.Delay(10);
    }
}

Example (Fluent Config API)

This package also supports the fluent configuration API provided by BenchmarkDotNet by adding a .WithGitReference() method to the Job class.

How It Works

Overrides the toolchain of Jobs with a git reference with a small decorator around the original toolchain. The decorator will checkout the git reference before running the benchmarks, change references for the benchmarks to this new checkout and then removes the folder after the benchmarks have completed.

Limitations

Works for my (simple) use case, but may not work for all. Please open an issue (or PR) if you have a use case that is not supported.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 962 9/4/2024