Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
.NET 9 Is Out (github.com/dotnet)
83 points by edtech_dev on Nov 13, 2024 | hide | past | favorite | 38 comments



Stephen Toub does an impressive performance deep dive blog post [0] every release. It's over 300 pages long!

[0] - https://devblogs.microsoft.com/dotnet/performance-improvemen...


Yeah, these posts are totally wild. The amount of work that goes into them blows my mind.


I'd be interested in seeing .net9 vs Java 22 vs Go vs Rust. But this probably won't happen. Simple hello world, Graphql, Grpc, RESTful api with a simple model.

And then spice up the concurrency and measure memory consumption as well, a 24h test.


TechEmpower benchmarks and The Benchmark Game[0] are pretty comprehensive. The latter has not yet been updated for .NET 9. The former has been updated with .NET 9[1], but will have to wait for the next round of results. You can see the continuous results, though[2]

I know that TechEmpower gets a lot of flak for being "unrealistic", but it's easy enough to filter out the pure middleware ones. But even those I feel are "fair game" because it shows that such optimizations are possible on the runtime if needed. The story behind one of the top entrants, Just(js) talks a bit about this[3]

[0] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

[1] https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...

[2] https://tfb-status.techempower.com/

[2] https://just.billywhizz.io/blog/on-javascript-performance-01...


This run has .NET 9 in: https://www.techempower.com/benchmarks/#section=test&runid=e...

Behind php and nginx.


It's interesting that the results on Techempower (on TE's hardware) remain relatively stale.

On the more "focused" application and micro benchmarks the difference between 7, 8 and 9 is very significant. The annual compiler improvements match those that take about 3 years for OpenJDK, and more for Golang. This has reached the point where you could reasonably expect e.g. LINQ to breathe down the Rust's iterators neck in un-vectorizable code (which is 98% of it), I didn't expect this would actually happen.

I have been told that each Linux kernel update tends to hit Techempower scores particularly hard, and practically everything in 75th percentile tends to be very sensitive to specific hardware configuration and DB driver implementation quality.

GC improvements while somewhat hurting Techempower too should make everyone deploying on small containers very happy as it pushes GC design in a Go-like direction with very minor hit to throughput (which is still massively better) while yielding significant sustained RSS reduction.

Personally, I feel like .NET has an identity crisis of sorts - it is being marketed as a regular high-level language for regular applications and web development, where it has plenty of competition.

At the same time it never seems to be marketed for low-level, systems and systems-adjacent scenarios, where .NET's competition is far behind. Any new DB or a message broker or a web server that is written in Java or Go would have benefited massively from being built with .NET instead, as proven by projects like Ryujinx and Garnet/FASTER. Nor it is being marketed at FP public - F# has access to the whole .NET ecosystem and easily slots into existing .NET projects better than Kotlin, Clojure or Scala do into Java ones.


    > Personally, I feel like .NET has an identity crisis of sorts - it is being marketed as a regular high-level language for regular applications and web development, where it has plenty of competition.
    > 
    > At the same time it never seems to be marketed for low-level, systems and systems-adjacent scenarios
I think it would be really good if they spun off a "T#" which moved closer to TypeScript and effectively chopped off some of the older syntax and even some of the features in favor of a more streamlined language.

C# and TypeScript are already fairly similar. In my mind, T# would be like a trimmed down C# with a bit more influence from F#.


fwiw

    .NET 8
    .NET 9 +
      
    4.605 binarytrees,csharpcore,7 
    5.336 binarytrees,csharpcore,7 + 

    5.229 binarytrees,csharpcore,1
    6.112 binarytrees,csharpcore,1 +

    4.725 binarytrees,csharpcore,2
    5.365 binarytrees,csharpcore,2 +

    12.565 binarytrees,csharpcore,8
    13.504 binarytrees,csharpcore,8 +

    5.076 binarytrees,csharpcore,3
    6.452 binarytrees,csharpcore,3 +

    2.219 fannkuchredux,csharpcore,5
    2.267 fannkuchredux,csharpcore,5 +
    
    11.337 fannkuchredux,csharpcore,3
    11.014 fannkuchredux,csharpcore,3 +
    
    9.076 fannkuchredux,csharpcore,9
    8.399 fannkuchredux,csharpcore,9 +
    
    8.665 fannkuchredux,csharpcore,6
    9.930 fannkuchredux,csharpcore,6 +
    
    40.509 fannkuchredux,csharpcore,8
    43.795 fannkuchredux,csharpcore,8 +
    
    29.589 fannkuchredux,csharpcore,2
    30.376 fannkuchredux,csharpcore,2 +
    
    11.103 fasta,csharpcore,8
    11.152,0 fasta,csharpcore,8 +
    
    1.206 fasta,csharpcore,9
    1.207 fasta,csharpcore,9 +
    
    1.502 fasta,csharpcore,5
    1.482 fasta,csharpcore,5 +
    
    1.838 fasta,csharpcore,1
    1.696 fasta,csharpcore,1 +
    
    3.043 knucleotide,csharpcore,1
    3.184 knucleotide,csharpcore,1 +
    
    40.687 knucleotide,csharpcore,7
    42.742 knucleotide,csharpcore,7 +

    70.598 knucleotide,csharpcore,8
    75.208 knucleotide,csharpcore,8 +
    
    5.057 knucleotide,csharpcore,6
    5.632 knucleotide,csharpcore,6 +
    
    11.672 knucleotide,csharpcore,4
    12.063 knucleotide,csharpcore,4 +
    
    6.822 mandelbrot,csharpcore,3
    6.793 mandelbrot,csharpcore,3 +
    
    26.665 mandelbrot,csharpcore,8
    26.408 mandelbrot,csharpcore,8 +
    
    3.195 mandelbrot,csharpcore,7
    3.206 mandelbrot,csharpcore,7 +
    
    45.641 mandelbrot,csharpcore,2
    46.193 mandelbrot,csharpcore,2 +
    
    3.233 mandelbrot,csharpcore,1
    3.929 mandelbrot,csharpcore,1 +
    
    4.039 mandelbrot,csharpcore,5
    4.055 mandelbrot,csharpcore,5 +
    
    7.796 nbody,csharpcore,1
    7.656 nbody,csharpcore,1 +
    
    4.793 nbody,csharpcore,7
    4.803 nbody,csharpcore,7 +
    
    6.645 nbody,csharpcore,3
    6.647 nbody,csharpcore,3 +
    
    6.440 nbody,csharpcore,0
    7.656 nbody,csharpcore,0 +
    
    7.254 nbody,csharpcore,8
    7.214 nbody,csharpcore,8 +
    
    3.164 nbody,csharpcore,9
    3.174 nbody,csharpcore,9 +
    
    4.822 nbody,csharpcore,6
    4.828 nbody,csharpcore,6 +   
    
    3.747 nbody,csharpcore,4    
    3.749 nbody,csharpcore,4 +
    
    6.831 nbody,csharpcore,2
    6.893 nbody,csharpcore,2 +
    
    1.359 pidigits,csharpcore,4
    1.291 pidigits,csharpcore,4 +
    
    0.928 pidigits,csharpcore,5
    0.839 pidigits,csharpcore,5 +
    
    6.590 pidigits,csharpcore,7
    7.148 pidigits,csharpcore,7 +
    
    0.960 pidigits,csharpcore,6
    0.818 pidigits,csharpcore,6 +
    
    1.371 regexredux,csharpcore,2
    1.361 regexredux,csharpcore,2 +
    
    2.108 regexredux,csharpcore,5
    1.741 regexredux,csharpcore,5 +
    
    4.598 regexredux,csharpcore,1
    4.598 regexredux,csharpcore,1 +
    
    7.309 revcomp,csharpcore,3
    8.472 revcomp,csharpcore,3 +
    
    0.585 revcomp,csharpcore,9
    0.586 revcomp,csharpcore,9 +
    
    2.639 revcomp,csharpcore,5
    2.534 revcomp,csharpcore,5 +
    
    1.642 revcomp,csharpcore,6
    1.551 revcomp,csharpcore,6 +
    
    1.559 revcomp,csharpcore,7
    1.543 revcomp,csharpcore,7 +
    
    2.972 revcomp,csharpcore,1
    3.140 revcomp,csharpcore,1 +
    
    0.933 spectralnorm,csharpcore,5
    0.938 spectralnorm,csharpcore,5 +
    
    5.387 spectralnorm,csharpcore,8
    5.405 spectralnorm,csharpcore,8 +
    
    1.519 spectralnorm,csharpcore,2   
    1.521 spectralnorm,csharpcore,2 +    
    
    1.544 spectralnorm,csharpcore,3
    1.539 spectralnorm,csharpcore,3 +


Memory usage for that synthetic web server benchmark is massive! 90% reduction


I have a web app that allocates too much memory relative to what it actually needs and upgrading to .NET 9 reduced its usage by two thirds!

A pretty good result for just changing a dropdown in the project settings tab.


I just want to point out that for years Microsoft told us to abandon WinForms and jump on WPF. Now we're years later and Winforms keeps getting new features.


They didn't add anything significant to the language this year. Maybe next year we will get new extensions feature.



Is this the feature that would let you put extension properties on everything?

The most obvious way to store backing fields for arbitrary objects is to have a global concurrent dictionary that stores weak keys, and a compiler-generated class to store the backing fields as the value. But then you have a performance problem of needing to do a lookup from a weak-concurrent-dictionary every time you access any extension backing field.

The higher-performance alternative would be a second shadow variable in code that uses the extension backing fields. Do your dictionary lookup, then cache the backing-fields-object so you don't need to redo lookups for it. But that would be function-local.

If the extension property doesn't need a new backing field, it's trivial, you're just making a new getter and setter function pair.


Did you mean C# the language?


Yes. Language and framework are released at the same time every year


Are there others?

Edit: include ;-) at the end. Client filtered it out...


Yes. There are three "official" .NET languages: C#, Visual Basic, and F#.

https://dotnet.microsoft.com/en-us/languages


Wow... I keep forgetting that VB.net is still a thing. Pretty much everyone who was writing ASP code before the switchover adopted VB.net and then flipped over to C# around 2005 (.NET version 2).


It’s a shame the “Iron” family of scripting language implementations seem to have stalled out.

IronPython and IronRuby had a lot of potential.


RIP J#


RIP Midori


Yes, they also released F# 9.


Argh, my client omitted a wink smiley I've included at the end . It was meant as a joke.


Did you mean "are there other things called C# besides the language?" I think people missed the joke because they interpreted your comment as "are there other .NET languages?"



Yep, nothing much for average applications. It's a pity that extension properties didn't make the cut.


Rather have it being designed carefully, than having a half baked feature like primary constructors.


That was on purpose. There was a lot of issue-closing on GitHub. Especially MAUI which got a ton of bug fixes.


MAUI looks really good in theory, I’m curious to hear about anyone’s experiences and thoughts about using it in production.


I've written 3 apps in MAUI with 2 in production.

The 2 apps in production are MAUI Blazor Hybrid apps. The learning curve was very small since I already was familiar with C# and Razor syntax after having built many C# server-side rendered web apps. Development is quite rapid since it's essentially using web technologies. For my use cases, the users do not care about the app looking native as these are B2B apps. Both apps are deployed in the 2 major mobile app stores and 1 app is also deployed in the Microsoft Store.

The 3rd app was an internal-only Android app built with the UI written entirely in C# instead of XAML. I chose to write the UI in C# instead of XAML primarily just for fun and to see how that would work out. I ran into a lot more issues using native UI when it came to me wanting to customize things, such as removing an annoying bottom text underline/border that is added by default to Entry (textbox) controls.

I'll probably never build another native UI app if I have the choice and will stick to MAUI Blazor Hybrid apps because it is so much faster to create the app using web technologies (HTML/CSS).


The DigiD app in the Netherlands, used by almost every citizen to log into government and government-related services (taxes, social security stuff, message box, seeing your own data, portal of local municipality, etc etc etc) is written in Xamarin Forms and is now written in MAUI for a while. It even made Hacker News a while ago due to the progress indicator!

https://news.ycombinator.com/item?id=34425614


Bitwarden moved away from MAUI IIRC maybe you can search about that


Is there a development environment for this which is graphical and interactive and as easy-to-use as say Visual Basic 1.0 or Livecode (formerly Runtime Revolution which was a HyperCard clone)?


The nearest thing is probably a Monaco based IDE that generates self-contained executables (like VB before .Net) with modernization for todays OS ecosystem.

twinBasic https://twinbasic.com


It's always a bit amusing to see comments like "ooh, large performance improvements, that's great" and "meh, no new shining language features, maybe next year" next to each other, but it does show that there is a healthy variety in the user base.


They’re not mutually exclusive. Most of the large performance improvements are from .NET, the runtime and compilers. They’re not related to C#.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: