TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go GC: Solving the Latency Problem in Go 1.5

179 pointsby beliualmost 10 years ago

9 comments

arcticbullalmost 10 years ago
I&#x27;ve worked with garbage collected languages (ruby, Java, Objective-C in the bad old days), automatic reference counting (Objective-C and Swift), in the Rust model and manual reference counting&#x2F;ownership in C over about 15 years now.<p>Having thought about this a lot, I just don&#x27;t really understand why people continue to work on garbage collection. Non-deterministic lifecycle of objects&#x2F;resources, non-deterministic pauses, huge complexity and significant memory and CPU overhead just aren&#x27;t worth the benefits.<p>All you have to do with ARC in Swift and Objective-C is type &#x27;weak&#x27; once in a while (which effectively builds a directed acyclic graph of strong references). With Rust you can get away with just structuring your code in accordance with their conventions.<p>I&#x27;m sure this won&#x27;t resonate with everyone but I think it&#x27;s time to walk away from GC. I&#x27;m curious, is there something I&#x27;m missing? The only true benefit I can think of is reducing heap fragmentation; and there must be a better way to address that.
评论 #9855909 未加载
评论 #9856718 未加载
评论 #9855867 未加载
评论 #9856874 未加载
评论 #9855807 未加载
评论 #9856028 未加载
评论 #9855720 未加载
评论 #9856377 未加载
评论 #9855886 未加载
评论 #9856065 未加载
评论 #9855761 未加载
评论 #9856152 未加载
评论 #9857428 未加载
评论 #9856562 未加载
评论 #9857577 未加载
alexbockalmost 10 years ago
&gt; ...there has been a virtuous cycle between software and hardware development. CPU hardware improves, which enables faster software to be written, which in turn...<p>This is the exact opposite of the experience I&#x27;ve had with (most) software. A new CPU with a higher clock speed makes existing software faster, but most new software written for the new CPU will burn all of the extra CPU cycles on more layers of abstraction or poorly written code until it runs at the same speed that old code ran on the old CPU. I&#x27;m impressed that hardware designers and compiler authors can do their jobs well enough to make this sort of bloated software (e.g. multiple gigabytes for a word processor or image editor) succeed in spite of itself.<p>There are of course CPU advancements that make a huge performance difference when used properly (e.g. SSE, multiple cores in consumer machines) and some applications will use them to great effect, but these seem to be few and far between.
评论 #9855536 未加载
评论 #9854931 未加载
评论 #9854935 未加载
评论 #9856947 未加载
评论 #9854892 未加载
评论 #9855204 未加载
mseepgoodalmost 10 years ago
Better images of the plots:<p><a href="https:&#x2F;&#x2F;pbs.twimg.com&#x2F;media&#x2F;CJatKFQUkAE5qcR.png:large" rel="nofollow">https:&#x2F;&#x2F;pbs.twimg.com&#x2F;media&#x2F;CJatKFQUkAE5qcR.png:large</a><p><a href="https:&#x2F;&#x2F;pbs.twimg.com&#x2F;media&#x2F;CJavrIAUMAAIaq8.png:large" rel="nofollow">https:&#x2F;&#x2F;pbs.twimg.com&#x2F;media&#x2F;CJavrIAUMAAIaq8.png:large</a>
_ph_almost 10 years ago
I am a bit surprised by most of the discussion here so far. Garbage collection has first of all one fundamental advantage: correctness. You are guaranteed never ever to have a pointer to a freed object and that any unreachable object does get freed. For almost all programs that get written, correctness should go over speed.<p>And speaking of speed, unless you require hard realtime behavior, garbage collection can be quite beneficial. A generational GC offers faster allocation times than any malloc based allocator, and the collection of the nursery generation is instantaneous in most cases. ARC has the overhead of counting for each referencing&#x2F;dereferencing and while it might predictable about kicking in when killing a reference frees memory, the time required to free a given object completely depends on how much objects get consequently freed.<p>Furthermore, garbage collection helps to write clean code, as it is safe (and usually cheap) to allocate memory during a function call and return results referencing the memory.<p>Of course, badly written programs might perform badly with GC - but without the same kind of programs would just be a disaster. And most strategies for efficient memory usage used in non-GC languages (e.g. memory pools for certain objects) can and should be equally used in GC languages.
davidwalmost 10 years ago
Erlang&#x27;s per-process (Erlang process, not Unix process) GC is pretty good from this point of view. I&#x27;m surprised they didn&#x27;t mention it as something to think about.
评论 #9855077 未加载
评论 #9854820 未加载
eggnetalmost 10 years ago
Interesting. I think the GC pauses are go&#x27;s biggest problem.<p>Looks like they are tackling this head on with positive results.
评论 #9854899 未加载
jdubalmost 10 years ago
Was the presentation more in-depth that this summary? I&#x27;d love to read or hear more about the changes.
评论 #9856398 未加载
davidgrenieralmost 10 years ago
And with this, I hope we&#x27;ll see a race for GC pauses improvements.
hit8runalmost 10 years ago
&quot;Go programs will get a little bit slower in exchange for ensuring lower GC latencies.&quot;<p>How much slower are Go1.5 programs compared to their Go1.4 version? Is this relevant for web apps?