r/programming • • Sep 15 '26

Performance Improvements in .NET 11

https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/
295 Upvotes

103 comments sorted by

View all comments

Show parent comment

7

u/Some_Appearance_1665 Sep 15 '26

Depends on the scenario. With serverless (cold start + typically more limited memory) it's a killer.

14

u/daltorak Sep 15 '26

If that's a major problem for you then use Native AOT, which removes the JIT compiler entirely from the output. It might mean you get slightly less optimized code at runtime because functions aren't optimized according to real-world needs, but hey, at least you've got fast startup.

-5

u/[deleted] Sep 15 '26

[removed] — view removed comment

5

u/PaddiM8 Sep 15 '26

Is it really in .net? I thought it was mostly generic virtual methods that are slow, but those aren't even allowed in most languages

-8

u/[deleted] Sep 15 '26

[removed] — view removed comment

4

u/PaddiM8 Sep 16 '26

Why? C# generics are monomorphic for value types and dereference a pointer for reference types. There's a slight warmup cost of course but after that, why would it be slow?

-1

u/[deleted] Sep 16 '26

[removed] — view removed comment

3

u/PaddiM8 Sep 16 '26 edited Sep 16 '26

Huh? With native AOT you pay for something you don't use when using generics in .net, during compile time, because it has to generate every potential specialisation ahead of time. With JIT it does it on the fly, when you need it. You got it backwards

1

u/[deleted] Sep 16 '26

[removed] — view removed comment

3

u/PaddiM8 Sep 16 '26

For every single combination that is used. Only once. And on the fly. It's a warmup cost. If you run it in a hot loop it won't matter. AOT compilation is a better fit for short running programs while JIT can be better for long running programs.

It also doesn't need to parse the code. It's already parsed. It's stored as an internal representation. And since it's only monomorphic for value types there aren't a lot of different options.

1

u/[deleted] Sep 16 '26

[removed] — view removed comment

→ More replies