Live data from Hacker News

Go does not need a Java-style GC

erik-engheim.medium.com

221–226 of 226 posts

Re: Go does not need a Java-style GC

#221

I'm cautious about believing this sort of claim because I remember reading about why Go doesn't need generics, yet here we are waiting for Go Generics to be ready. However, the article convincingly explains who Java has a greater need for a compacting GC - it creates more garbage. This doesn't necessarily mean Go won't benefit from having a generational, compacting GC at some point, for some applications.

Go designers never said they would never add generics. I've followed Go from the start and they have always been clear that they would consider adding generics if they found a good design for it. However they never had it as a high priority.

Many Go fans have said does not need generics, and many including myself would still argue that it doesn't need generics. Yet I cannot say I mind that Go adds generics. I am just worried about whether Go manages to retain its simplicity. Time will tell.

I have been a professional Swift programmer who has had ALL the features people have been shouting about for years that Go should have, yet it cannot be said to be a better language. A lot of these features also make Swift more clunky to use than Go in many instances.

Having said that, I like both Swift and Go. I just cannot see that more is always more.

Re: Go does not need a Java-style GC

#222
post #73

Earlier quoted context omitted.

> Go users have to work around using ugly hacks when hit, because they don't have tuning knobs Yeah, Java users just have to hire Java performance tuning experts from sprawling Java perf consulting cottage industry. Can't get much simpler than that.

Even if you need an expert, it’s safer and cheaper than rewriting the critical path several times hoping for better behavior.

I don't get this attitude. Optimizing your code is a pretty normal thing to do. Running performance analysis, finding hotspots and tuning them.

I would prefer tuning my code over tuning a garbage collector as tuning code is more transparent. It depends on your background. If you are used to native code development like me, then you are used to thinking about how code get compiled and how memory is used.

I suppose in the Java world, these things are treated as black boxes. The downside of that is that you get no stability under your feet. Everything is up to whatever garbage collector you use and how that is tuned. I am sure many people like that, but I would prefer to be in control over my own code and understand why it performs and doesn't perform. I want optimization to be explicit rather than based on lots of magical tweaking by some GC expert.

Re: Go does not need a Java-style GC

#223
post #116

Earlier quoted context omitted.

throughput can be fixed by adding compute. latency cannot. always optimize for latency with gc. and no the heap will not keep growing in golang. it'll force threads to help with GC if its falling behind. thereby reducing the rate of allocations and speeding up the collection.

Only in some kinds of apps, like web servers where all the heavy lifting is being done by the database anyway. Consider a compiler. It's not infinitely scalable to multiple cores. It may not even be multi-threaded at all. It also doesn't care about pause times - for that you want Parallel GC.

For a compiler, the GC strategy that makes most sense is to never deallocate. The compiler is going to die shortly. No need to do the bookkeeping of figuring out how to deallocate before that happens.

Re: Go does not need a Java-style GC

#224
It’s an insightful article, but I can’t get around the fact that almost every paragraph contains subtle typos. Makes me wonder, whether the author bothered to do a final pass on the text, or just dumped everything out of his mind, and hit Publish.

Re: Go does not need a Java-style GC

#225
post #224

It’s an insightful article, but I can’t get around the fact that almost every paragraph contains subtle typos. Makes me wonder, whether the author bothered to do a final pass on the text, or just dumped everything out of his mind, and hit Publish.

Or maybe isn't a native English speaker and did a wonderful job in a second language?

Re: Go does not need a Java-style GC

#226

Earlier quoted context omitted.

Quantitative measures would be nice, but I would imagine that it's going to be really difficult to quantitatively compare go and java garbage collectors, without a billion other factors about the language/runtime getting in the way.

I doubt it'll be that hard. Just write the same memory intense routine in both languages, and time it running in a loop for a couple million executions. Make sure the code is idiomatic and optimized.

> Make sure the code is idiomatic and optimized.

Those are basically opposite ends of the same axis.

Heavily optimized code is never idiomatic in any language. If the natural, idiomatic code were fast enough it wouldn’t need to be optimized!

Post reply on HN