For C# as is, what I really would appreciate is a frozen GC mode. Not zero GC, similar to Epsilon GC in Java. After initial state loading and forced GC, I would like to be able to apply a SustainedNoGC mode, that just does not even try to collect, no scanning, no pauses at all, it can only allocate. And notifications (an event) after some X bytes allocated, or just a reliable way to monitor the allocated size. The existing modes such as SustainedLowLatency or NoGCRegion are good but not enough. For some low latency workloads it's OK to allocate many GBs and then pause explicitly.
Random forced pauses are the only problem that comes from GC, otherwise it's great for throughput and just a nice feature, as a sibling comment says. No GC languages do not make code magically faster, they still have malloc/free. However, GC is surrendering control over when a program may be paused.
.NET has supported custom garbage collectors for many years, so if you're willing to accept that all heap-allocated objects will live as long as your process, implementing a no-op garbage collector should be a straightforward exercise.
TBH, at least in my head, I feel like what it needs more is a 'string-ish type that can be used in a pool'.
With Pooling/Arenas already semi-established, you can do lots of stuff with pools/arenas. Where the challenge comes, is how much of Corelib (and normal apps) use strings in places, and you can't get around that without a lot of DIY. The "foostring" u8 const conversion helps for some cases but doesn't cover nearly enough cases.
Assuming this is very similar to bflat: it's a cool idea and fun to play with, but not very useful. C# is not designed to run without a GC, existing code usually won't run, because the standard library is missing.
Just using C, Rust, Zig, or whatever is probably nearly always the better option. Those languages are designed to work without GC and provide various well established ways to manage memory.
You really don't want to use C# with the "Bflat/Zero" runtime library. Even something very basic like strings is unsupported. It becomes C code with funny syntax that doesn't align well with the language.
I have not yet tested out Beef, but it seems to be more in line with what you'd want from a native C#-like language.
I looked for DLL support and found nothing. The standard library is also different from C#, and you have to manage memory on your own. Sadly I don't get the point. People code in C# for the .NET and its huge library, unless this is not a drop in replacement, you have to port your whole codebase; well then people will write Rust already...
Comments (137) 32 threads
Earlier commentsRandom forced pauses are the only problem that comes from GC, otherwise it's great for throughput and just a nice feature, as a sibling comment says. No GC languages do not make code magically faster, they still have malloc/free. However, GC is surrendering control over when a program may be paused.
Continue this thread — 2 replies
With Pooling/Arenas already semi-established, you can do lots of stuff with pools/arenas. Where the challenge comes, is how much of Corelib (and normal apps) use strings in places, and you can't get around that without a lot of DIY. The "foostring" u8 const conversion helps for some cases but doesn't cover nearly enough cases.
Just using C, Rust, Zig, or whatever is probably nearly always the better option. Those languages are designed to work without GC and provide various well established ways to manage memory.
I have not yet tested out Beef, but it seems to be more in line with what you'd want from a native C#-like language.
All comments shown.
Couldn't load more comments. Check your connection and try again.