Created
April 19, 2019 03:01
-
-
Save Zhentar/deb1afb9bc30ed2a82583a348729dc9f to your computer and use it in GitHub Desktop.
BDN overhead compensation test sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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