Most active commenters
  • pjmlp(4)

←back to thread

271 points mithcs | 15 comments | | HN request time: 0.001s | source | bottom
Show context
cachius ◴[] No.45953162[source]
A recent superpower was added by Fil aka the pizlonator who made C more Fil-C with FUGC, a garbage collector with minimal adjustments to existing code, turning it into a memory safe implementation of the C and C++ programming languages you already know and love.

https://news.ycombinator.com/item?id=45133938

https://fil-c.org/

replies(3): >>45953284 #>>45953390 #>>45954377 #
762236 ◴[] No.45953390[source]
Why would I want to run a garbage collector and deal with it's performance penalties?
replies(4): >>45953453 #>>45953598 #>>45953991 #>>45961132 #
jerf ◴[] No.45953598[source]
Because about 99% of the time the garbage collect is a negligible portion of your runtime at the benefit of a huge dollop of safety.

People really need to stop acting like a garbage collector is some sort of cosmic horror that automatically takes you back to 1980s performance or something. The cases where they are unsuitable are a minority, and a rather small one at that. If you happen to live in that minority, great, but it'd be helpful if those of you in that minority would speak as if you are in the small minority and not propagate the crazy idea that garbage collection comes with massive "performance penalties" unconditionally. They come with conditions, and rather tight conditions nowadays.

replies(6): >>45953687 #>>45953716 #>>45953741 #>>45953976 #>>45959310 #>>45960864 #
1. Phil_Latio ◴[] No.45953741{3}[source]
> Because about 99% of the time the garbage collect is a negligible portion of your runtime

In a system programming language?

replies(3): >>45953871 #>>45953930 #>>45955348 #
2. pjmlp ◴[] No.45953871[source]
Yes, plenty have been done already so since Lisp Machines, Smalltalk, Interlisp-D, Cedar, Oberon, Sing#, Modula-2+, Modula-3, D, Swift,....

It is a matter to have an open mindset.

Eventually system languages with manual memory management will be done history in agentic driven OSes.

replies(2): >>45954791 #>>45960404 #
3. Snarwin ◴[] No.45953930[source]
There's plenty of application-level C and C++ code out there that isn't performance-critical, and would benefit from the safety a garbage collector provides.
replies(1): >>45956666 #
4. KerrAvon ◴[] No.45954791[source]
Swift, by design, does not have GC.
replies(2): >>45955042 #>>45955223 #
5. pebal ◴[] No.45955042{3}[source]
RC is a GC method and the least efficient one.
replies(1): >>45958203 #
6. pjmlp ◴[] No.45955223{3}[source]
Chapter 5,

https://gchandbook.org/contents.html

It would help if all naysayers had their CS skills up to date.

7. jerf ◴[] No.45955348[source]
Whether or not GC is a negligible portion of your runtime is a characteristic of your program, not your implementation language. For 99% of programs, probably more, yes.

I have been working in GC languages for the last 25 years. The GC has been a performance problem for me... once. The modal experience for developers is probably zero. Once or twice is not that uncommon. But you shouldn't bend your entire implementation stack choice over "once or twice a career" outcomes.

This is not the only experience for developers, and there are those whose careers are concentrated in the places where it matters... databases, 100%-utilization network code, hardware drivers. But for 99% of the programs out there, whatever language they are implemented in, GC is not an important performance consideration. For the vast bulk of those programs, there is a much larger performance consideration in it that could be turned up in 5 minutes with a profiler and nobody has even bothered to do that and squeeze out the accidentally quadratic code because even that doesn't matter to them, let alone GC delays.

This is the "system programmer's" equivalent of the web dev's "I need a web framework that can push 2,000,000 requests per second" and then choosing the framework that can push 2,001,000 rps over the one that can push 2,000,000 because fast... when the code they are actually writing for the work they are actually doing can barely push 100 rps. Even game engines nowadays have rather quite a lot of GC in them. Even in a system programming language, and even in a program that is going to experience a great deal of load, you are going to have to budget some non-trivial optimization time to your own code before GC is your biggest problem, because the odds that you wrote something slower than the GC without realizing it is pretty high.

replies(1): >>45956106 #
8. Phil_Latio ◴[] No.45956106[source]
> Whether or not GC is a negligible portion of your runtime is a characteristic of your program, not your implementation language.

Of course, but how many developers choose C _because_ it does not have a GC vs developers who choose C# but then work around it with manual memory management and unsafe pointers? ....... It's > 1000 to 1

There are even new languages like C3, Odin, Zig or Jai that have a No-GC-mindset in the design. So why you people insist that deliberately unsafe languages suddenly need a GC? There a other new languages WITH a GC in mind. Like Go. Or pick Rust - no GC but still memory safe. So what's the problem again? Just pick the language you think fits best for a project.

9. jvanderbot ◴[] No.45956666[source]
Right, does `sudo` net benefit from removal of heap corruption, out of bounds, or use after free, etc errors that GC + a few other "safeties" might provide? I think so!
10. winrid ◴[] No.45958203{4}[source]
It's the most predictable and has much less overhead than a moving collector.
replies(1): >>45958511 #
11. pjmlp ◴[] No.45958511{5}[source]
Only when we forget about the impact of cycle collections, or domino effects stoping the world when there is a cascade of counters reaching zero.

The optimisatios needed to improve such scenarions, are akin to a poor man's tracing GC implementation.

replies(1): >>46029199 #
12. HumanOstrich ◴[] No.45960404[source]
"Agentic driven OSes"? Sounds like AI hype babble.
replies(1): >>45962553 #
13. pjmlp ◴[] No.45962553{3}[source]
Hype or not, that is what is being pushed

https://www.windowscentral.com/microsoft/windows-11/microsof...

https://www.klover.ai/apple-uses-ai-agents-10-ways-to-use-ai...

replies(1): >>45962707 #
14. HumanOstrich ◴[] No.45962707{4}[source]
What does this have to do with system languages with manual memory management going away?
15. winrid ◴[] No.46029199{6}[source]
I didn't forget. That's predictable. It happens when the application code does something, or stops doing something, as opposed to the moving collector just doing it at random times.