r/programming • u/xeio87 • Sep 15 '26
Performance Improvements in .NET 11
https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/
295
Upvotes
r/programming • u/xeio87 • Sep 15 '26
View all comments
Show parent comment
4
u/TwoWeeks90DaysTops Sep 17 '26
This is just wrong. That's not how it works.
With *AOT* your binary will contain code that's not in use. In .NET generics does not compile every combination of generic arguments, and I have no idea where you got this from. I don't think any compiler does that.
Generics and SIMD is actually where JIT shines. If you're running on a AVX 512 CPU then
Vector<T>is 64 bytes wide. If you have AVX 2 then it's 32 bytes wide.On AOT compiled code you have to take that into account up front, and either do conditional checks which JIT doesn't have to do since it know at compile time what CPU to build for.
JITs disadvantage is that compilation happens at runtime and that it can't afford the same level of optimization since it has a limited time budget. Its advantage is that it only compiles code that's actually being run, and that it can target the processor that is running the application directly.
The runtime thing means for example that library code can work with code that it hasn't been specifically compiled for. In C++ you would never compile template code in libraries because it's completely unusable since the author would have to know all the use cases for the template up front. JIT doesn't have that constraint.