After looking through the CIL of some test applications I build, I noticed that Roslyn produces some extra nop instructions instead of just directly branching to the given code block.
I used the latest version of Visual Studio 2026 Community alongside .NET 10.0.201.
The code used to produce this CIL:
namespace TEST_CS_NET_10
{
internal class Program
{
static void Main(string[] args)
{
for(int i = 0; i <= 10; i++)
{
Console.WriteLine(i);
}
}
}
}
Is this just lazy compiler design, intentional or overseen? I dont see the debug use for these instructions, especially since its a release build.
Would this cause excess file size / performance issues in large, intense projects or has this been ignored simply because its too trivial?
After looking through the CIL of some test applications I build, I noticed that Roslyn produces some extra nop instructions instead of just directly branching to the given code block.
I used the latest version of Visual Studio 2026 Community alongside .NET 10.0.201.
The code used to produce this CIL:
Is this just lazy compiler design, intentional or overseen? I dont see the debug use for these instructions, especially since its a release build.
Would this cause excess file size / performance issues in large, intense projects or has this been ignored simply because its too trivial?