top | item 46994085

(no title)

rafaelmn | 17 days ago

Ironically those optimizations came from .NET avoiding GC and introducing primitives to avoid it better.

And .NET is moving heavily into the AoT/pre-compilation direction for optimization reasons as well (source generators, AoT).

If you look at the change logs for the past few versions of the framework from perf perspective the most significant moves are : introduce new primitives to avoid allocating, move more logic to compile time, make AoT better and work with more frameworks.

discuss

order

pjmlp|16 days ago

So what, that is exactly the point.

A programming language having a GC doesn't mean every single allocation needs to be on the heap.

C# is finally at the sweet spot languages like Oberon, Modula-3 and Eiffel were on the late 90's, and unfortunely were overshadowed by Java's adoption.

Go and Swift (RC is a GC algorithm) are there as well.

D could be there as well on the mainstream, if there was a bit more steering into what they want to be, instead of having others catching up on its ideas.

That is what made me look into the language after getting Andrei Alexandrescu's book.

rafaelmn|16 days ago

The point is that if you need performance you need to drop below tracing GC, and depending on your use-case, if that's the majority of your code it makes sense to use a language that's built for that kind of programming (zero cost abstractions). Writing C# that doesn't allocate is like wearing a straightjacket and the language doesn't help you much with manual memory management. Linters kind of make it more manageable but it's still a PITA. It's better than Java for sure in that regard, and it's excellent that you have the option for hot paths.