It took Microsoft 14 years to build .NET for Linux
C# programs still compile to IL, and the runtime's JIT still compiles that IL to native code. This is the same as in 2002, when I started with .NET. What changed is when that happens and how much the runtime learns about the app when it runs.
Here are the nine steps:
𝟭. 𝟮𝟬𝟬𝟮, .𝗡𝗘𝗧 𝗙𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸 𝟭.𝟬. It was the first CLR, together with a JIT compiler and a garbage collector. Windows only.
𝟮. 𝟮𝟬𝟭𝟲, .𝗡𝗘𝗧 𝗖𝗼𝗿𝗲 𝟭.𝟬. The runtime is now open source and can target Linux and macOS as well as Windows.
𝟯. 𝟮𝟬𝟭𝟵, .𝗡𝗘𝗧 𝗖𝗼𝗿𝗲 𝟯.𝟬. Tiered JIT compilation is now here by default. Methods are compiled without optimizations the first time. If a method is "hot", it gets recompiled in the background with optimizations.
𝟰. 𝟮𝟬𝟮𝟬, .𝗡𝗘𝗧 𝟱. Microsoft drops "Core" from the name and skips version 4. .NET Framework continues as a separate product, and mobile support doesn't arrive until .NET 6.
𝟱. 𝟮𝟬𝟮𝟮, .𝗡𝗘𝗧 𝟳. Native AOT compiles the entire app ahead of time, at publish, without JIT runs. Start-up gets faster and memory use is smaller, at the expense of features like Reflection.Emit.
𝟲. 𝟮𝟬𝟮𝟯, .𝗡𝗘𝗧 𝟴. The JIT uses Dynamic PGO by default. It collects information about your app as it runs, like which branches are taken and which types are used, and uses it to improve performance. Microsoft says by as much as 20%.
𝟳. 𝟮𝟬𝟮𝟰, .𝗡𝗘𝗧 𝟵. Server GC adapts the size of the heap to the needs of the app. In TechEmpower benchmarks on a 48-core machine, Microsoft measured more than 80% less memory with only a 2 to 3% drop in throughput.
𝟴. 𝟮𝟬𝟮𝟱, .𝗡𝗘𝗧 𝟭𝟬. When the JIT can prove that an object won't escape its method, it can allocate it on the stack instead of the heap, so the GC doesn't have to track it. This now covers small arrays and delegates.
𝟵. 𝟮𝟬𝟮𝟲, .𝗡𝗘𝗧 𝟭𝟭. With runtime async, the work behind async/await moves from the C# compiler to the runtime. Apps need to opt in to use it, although the .NET libraries already do.
Back to you, which version of .NET are you using in production right now?
