Last active
November 1, 2019 18:22
-
-
Save EgorBo/c9e2b59be61c14de9d1f3a903424e7ea to your computer and use it in GitHub Desktop.
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 System; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
public class P | |
{ | |
static void Main() | |
{ | |
for (int i = 0; i < 1000; i++) | |
{ | |
Test(0, 0, 1); | |
Thread.Yield(); | |
} | |
} | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
static void Test(int x, int y, int z) | |
{ | |
// first two are always `0` so it makes sense to check `z` first | |
if (x == 0 && y == 0 && z == 0) | |
throw new Exception("unreachable"); | |
// so I expect PGO to roll it to | |
// if (z == 0 && x == 0 && y == 0) | |
// throw new Exception("unreachable"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment