4 ms·
I really like .NET, but I feel like their GC implementation is really lacking in performance. Their codegen is great, that's why their focus was on trying to re
by torginus 5y ago
I really like .NET, but I feel like their GC implementation is really lacking in performance. Their codegen is great, that's why their focus was on trying to reduce the amount of allocations in the past few releases.
I've recently written a pretty compute-heavy app in .NET 5 that generated some garbage (mostly nursery stuff), and I tried to run it on a 16-core CPU.
The results were disappointing, even with the Server GC, mainly due to the fact that the GC still does a ton of stop-the-world pauses, and the amount of garbage basically scaled linearly with the number of threads.
My benchmarking results indicated that adding more than 8 threads were basically pointless, since the increased garbage meant that more time was spent in STW GC mode.
I 'fixed' the perf issue, by eliminating all GC allocations, which alone resulted in a 2x speedup per thread, and allowed basically perfect scaling across cores.
In the day and age where you can rent 64 core CPU VMs for $2/hour, I wish they would spend more engineering effort on fixing this.
- pjmlp 5y agoI have been in both ecosystems since they exist, and I think .NET suffers a bit from .NET vs C++ wars at Microsoft. You can see this in practice when following up which tech gets out and how it evolves across its lifetime. I bet many teams before the whole C# 7 effort, would just write a couple of COM stuff in ATL, call them, from .NET and be done with it. This is also why WinRT was designed the way it was, given that Windows Dev was driving it.
- wesnerm2 5y agoThere is also that background or concurrent GC option in .NET, if you have a lot of threads.