Skip to content

Instantly share code, notes, and snippets.

@Zhentar
Created April 19, 2019 03:01
Show Gist options
  • Save Zhentar/deb1afb9bc30ed2a82583a348729dc9f to your computer and use it in GitHub Desktop.
Save Zhentar/deb1afb9bc30ed2a82583a348729dc9f to your computer and use it in GitHub Desktop.
BDN overhead compensation test sample
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace BDNTest
{
public class Program
{
public static void Main() => BenchmarkRunner.Run<OverheadTests>();
}
[SimpleJob]
public class OverheadTests
{
private int _field;
[Benchmark]
public void OneIncrement()
{
_field++;
}
[Benchmark]
public void TwoIncrement()
{
_field++;
_field++;
}
[Benchmark]
public void ThreeIncrement()
{
_field++;
_field++;
_field++;
}
[Benchmark]
public void FourIncrement()
{
_field++;
_field++;
_field++;
_field++;
}
[Benchmark]
public void FiveIncrement()
{
_field++;
_field++;
_field++;
_field++;
_field++;
}
[Benchmark]
public void SixIncrement()
{
_field++;
_field++;
_field++;
_field++;
_field++;
_field++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment