3 ms·
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
by rafaelmn 8mo 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.
- pjmlp 8mo agoI rather have the productivity of a GC (regardless of which kind), manual allocations on system/unsafe code blocks, and value types, than going back to bare bones C style programming, unless there are constraints in place that leave no other option. Note that even Rust's success, has triggered managed languages designers to research how far they can integrate linear, affine, effects, dependent types into their existing type systems, as how to combine the best of both worlds. To the point that even Rust circles now there are those speaking about an higher level Rust that is supposed be more approachable.
- gavinray 8mo agoThis is essentially how I feel -- GC by default with user control over zero-copy/stackalloc behavior. Modern .NET isn't even difficult to avoid allocations, with the Span<T> API and the work they've done to minimize unnecessary copies/allocs within the std lib. (I say this as a Kotlin/JVM dev who watches from the sideline, so not even the biggest .NET guy around here)
- arcadia_leak 8mo ago> Writing C# that doesn't allocate is like wearing a straightjacket Yes, and that's where D is majorly superior to C# -- it's flexible enough for you to go down to the metal for the critical parts.
- pjmlp 8mo agoThat is the no longer the case in C# 14/.NET 10, D has lost 16 years counting from Andrei's book publishing date, letting other programing languages catch up to more relevant features. You are forgetting that a language with a less mature ecosystem isn't much help.
- arcadia_leak 8mo ago> C# 14/.NET 10 Yes, they added AOT but it's still challenging to do anything that requires calling into the OS, because you're going to need the bindings. It will still add some overhead under the hood and more overhead will you need to add yourself to convert the data to blittable types and back. Mixing C# with other languages in the same project is also difficult because it only supports MSBuild. > You are forgetting that a language with a less mature ecosystem isn't much help. Fair.
- pjmlp 8mo agoYou also need bindings in D, nothing new there. Rust also has issues using anything besides cargo.
- arcadia_leak 8mo ago> You also need bindings in D, nothing new there. You don't. Any D compiler is a C compiler too, so it can take C headers without bindings or any overhead added.
- pjmlp 8mo agoYou have forgotten the footnote that not everything has a C API, not BetterC supports everything in ISO C, or common extensions. Hint, before keeping to discuss what D can and cannot do, better go look how long I have been around on D forums, or existing projects on my Github.
- 8mo ago