It is a little more nuanced that just being compiled as a poorly optimized compiler can generate slow code. That being said, there has been a ton of work on the .NET Runtime to increase speed. There is even more improvements coming out in .NET Core 3 as well