Last active
July 27, 2021 12:51
-
-
Save badamczewski/ec4fd63661276e2a375bcd2389692936 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class Bench92 | |
{ | |
[Benchmark(Baseline = true)] | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
[Arguments(0)] | |
public int A(int x) | |
{ | |
try { _ = 1; } catch { } | |
for (int i = 0; i < 10000; i++) { | |
x++; x++; x++; x++; | |
} | |
return x; | |
} | |
[Benchmark()] | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
[Arguments(0)] | |
public int B(int x) | |
{ | |
try { _ = 1; } catch { } | |
var y = x; | |
for (int i = 0; i < 10000; i++) { | |
y++; y++; y++; y++; | |
} | |
return y; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment