Live data from Hacker News

What .NET 10 GC changes mean for developers

roxeem.com

191–200 of 253 posts

Re: What .NET 10 GC changes mean for developers

#191
post #149
post #27

A hobby audio and text analysis application I've written, with no specific concern for low level performance other than algorithmically, runs 4x as fast in .net10 vs .net8. Pretty much every optimization discussed here applies to that app. Great work, kudos to the dotnet team. C# is, imo, the best cross platform GC language. I really can't think of anything that comes close in terms of performance, features, ecosyste…

Java? Is supported on more platforms, has more developers, more jobs, more OSS projects, is more widely used (Tiobe 2024). Performance was historically better, but c# caught up.

My experience was that .NET programs were typically more tunable for greater perf than Java for many years now even if it didn't come free out of the box which generally is what matters with performance. The ability to optimise further what needs to be optimised means that generally you are faster for your business domain than the alternative - with Java code it generally is harder and/or less ergonomic to do this.

For example just having value types and reified generics as a combination meant you could write generic code against value types which usually meant for hot algorithmic loops or certain data structures a big win w.r.t memory and CPU consumption. For example for a collection type critical to an app I wrote many years ago the use of value types would almost half the memory footprint compared to the best Java one I could find, and was somewhat faster with less cache misses. The Java alternative wasn't an amateur one either but they couldn't get the perf out of it even with significant effort.

It also last time I checked doesn't have a value decimal type for financial math which IMO can be a significant performance loss for financial/money based systems. Anything with math, and lots of processing/data structures for example I would find .NET significantly faster after doing the optimisation work. If I had to choose the 2 targets these days I would find .NET in general an easier target w.r.t performance. Of course perf isn't everything depending on the domain.

Re: What .NET 10 GC changes mean for developers

#192

Earlier quoted context omitted.

I don't really understand why Microsoft didn't do a Tauri like thing for C# devs instead of this Maui stuff. It would be a tiny project in comparison and then isn't completely going against the grain like Maui is. If you want a write once / run in more places compromise, the browser already does that very well.

Because web UI for a desktop app sucks compared to actual native UI. As a user, any time that I see an app uses Electron, Tauri or any of that ilk, I immediately look for an alternative because the user experience will be awful.

Worse than WPF?

Re: What .NET 10 GC changes mean for developers

#193
post #7
post #3

Interesting, I mostly work in JVM, and am always impressed how much more advanced feature-wise the .NET runtime is. Won't this potentially cause stack overflows in programs that ran fine in older versions though?

One limitation of the stack is that it needs to be contiguous virtual addresses, so it was often limited when devices just didn't have the virtual address space to "waste" on a large stack for every thread in a process. But 64 bits of virtual address space is large enough that you can keep the stacks far enough apart that even for pretty extreme numbers of threads you'll run out of physical memory before they start c…

> So you can always just allocate more physical pages to the stack as needed, similar to the heap.

You set the (max) stack size once when you create the thread and you can’t increase the (max) size after that.

Processes see a virtual address space that is handled by the OS, so you would have to involve the OS if you needed to add to the stack size dynamically.

Re: What .NET 10 GC changes mean for developers

#194

Earlier quoted context omitted.

I'd much rather code F# than Python, it's more principled, at least at the small scale. But F# is in many ways closer to modern mainstream languages than a modern pure functional language. There's nothing scary about it. You can write F# mostly like Python if you want, i.e. pervasive mutation and side effects, if that's your thing.

If Python is the only language you have to compare other languages to, all other programming languages are going to look like "Python with X and Y differences". It makes no sense to compare Python to F# when OCaml exists and is a far closer relative. F# isn't quite "OCaml on .NET" but it's pretty close.

It absolutely does make sense to compare it to the worlds most popular programming language, especially when dismissed as "functional programming". Who benefits from an OCaml comparison? You think F# should be marketed to OCaml users who might want to try dotnet? That's a pretty small market.

Re: What .NET 10 GC changes mean for developers

#195
post #44

Earlier quoted context omitted.

> C# is, imo, the best cross platform GC language. I really can't think of anything that comes close How about F#? Isn't F# mostly C# with better ergonomics?

Lmao, functional programming is far from ergonomic

honestly this sounds like you've never really done it. FP is much better for ergonomics, developer productivity, correctness. All the important things when writing code.

Re: What .NET 10 GC changes mean for developers

#196
post #27

A hobby audio and text analysis application I've written, with no specific concern for low level performance other than algorithmically, runs 4x as fast in .net10 vs .net8. Pretty much every optimization discussed here applies to that app. Great work, kudos to the dotnet team. C# is, imo, the best cross platform GC language. I really can't think of anything that comes close in terms of performance, features, ecosyste…

Except for F#, which also gets all the .NET10 cross-platform GC improvements for free and is a better programming language than C#.

+1 F# is criminally under-used

Re: What .NET 10 GC changes mean for developers

#197
post #27

A hobby audio and text analysis application I've written, with no specific concern for low level performance other than algorithmically, runs 4x as fast in .net10 vs .net8. Pretty much every optimization discussed here applies to that app. Great work, kudos to the dotnet team. C# is, imo, the best cross platform GC language. I really can't think of anything that comes close in terms of performance, features, ecosyste…

>runs 4x as fast in .net10 vs .net8.

Is this open source? Do you have numbers? I've been coding in .NET since it was "a thing" and frankly I'm having trouble mapping the optimizations to a local application at that magnitude.

The optimizations are seen at scale, they really won't mean much for your local application. Not a 3x+ improvement at least.

Re: What .NET 10 GC changes mean for developers

#198

Do these updates mean that the JIT can finally optimize LINQ away into simple loops?

LINQ doesn't need the JIT for that. I don't even think it is the JIT's responsibility to be aware of a specific library and optimize for it.

LINQ does a lot of work behind the scene to optimize for speed and reduce allocations. An example can be found here [1]. These optimizations are mostly about reducing the various LINQ patterns into simple for loops.

[1] https://github.com/dotnet/runtime/blob/main/src/libraries/Sy...

Re: What .NET 10 GC changes mean for developers

#199
post #29

Earlier quoted context omitted.

.net core on Linux works great btw.

As long as it's your deployment target and nothing else. For development, both macOS and Linux continue to be second class citizens, and I don't see this changing as it goes against their interests. In most .NET shops around me, the development and deployment tooling is so closely tied to VS that you can't really not use it. It's fine if you stick to JetBrains and pay for their IDE (or do non-commercial projects only…

No. My entire office is Linux and macOS. Not a single windows machine. Mixture of people using VS Code and Rider. No issues building and deploying to Linux. We pay for rider. Pay nothing for vscode.

Re: What .NET 10 GC changes mean for developers

#200
post #45
post #27

A hobby audio and text analysis application I've written, with no specific concern for low level performance other than algorithmically, runs 4x as fast in .net10 vs .net8. Pretty much every optimization discussed here applies to that app. Great work, kudos to the dotnet team. C# is, imo, the best cross platform GC language. I really can't think of anything that comes close in terms of performance, features, ecosyste…

Having worked with C# professionally for a decade, going through the changes with LINQ, async/await, Roslyn, and the rise of .NET Core, to .NET Core becoming .NET, I disagree. I certainly think that C# is a great tool and that it’s the best it has ever been. It’s also relies on very implicit behaviour, it is build upon OOP design principles and a bunch of “needless” abstraction. Things I personally have come to view…

I have been coding in C# for 16 years and I have no idea what you mean by "hidden indirection and runtime magic". Maybe it's just invisible to me at this point, but GC is literally the only "invisible magic" I can think of that's core to the language. And I agree that college-level OOP principles are an anti-pattern; stop doing them. C# does not force you to do that at all, except very lightly in some frameworks where you extend a Controller class if you have to (annoying but avoidable). Other than that, I have not used class inheritance a single time in years, and 98% of my classes and structs are immutable. Just don't write bad code; the language doesn't force you to su all.
Post reply on HN