3 ms·
As the article also states, it's possible to remove those write barriers by hashing. I don't see any reason why it shouldn't be possible to use the same scheme
by pcwalton 8y ago
As the article also states, it's possible to remove those write barriers by hashing. I don't see any reason why it shouldn't be possible to use the same scheme for copying generational GC.
The most important point, though, is that you don't know whether the hypothesis that Go wouldn't benefit from generational GC is true until you test it. Nobody has tested it. And there is plenty of indirect evidence to suggest that this is not true. For one, Go programmers have a habit of manually microoptimizing short-lived allocations to keep escape analysis "happy", which is something that becomes much less important with bump allocation in the nursery. Another simple observation is that .NET has the same situation regarding value types as Go does, and .NET uses a copying generational garbage collector. A final observation is that certain situations, like indirect calls [1], cause objects to be spilled to the heap unconditionally.
[1]: https://github.com/golang/go/blob/964639cc338db650ccadeafb7424bc8ebb2c0f6c/src/cmd/compile/internal/gc/esc.go#L1446 https://github.com/golang/go/blob/964639cc338db650ccadeafb74...
- enneff 8y ago> Go programmers have a habit of manually microoptimizing short-lived allocations to keep escape analysis "happy" I've been writing Go for 8+ years and have never done this, and I wouldn't approve a code review of a teammate that did this.
- pcwalton 8y agoBut that's what the article says: "We started creating tools to help our users find objects that escaped and if it was minor they could make changes to the code and help the compiler allocate on the stack."
- enneff 8y ago"Tools used by a small minority of users to find performance issues," != "Go programmers have a habit of microoptimizations to avoid heap allocations." You are being disingenuous.
- deleted 8y ago[deleted]
- geodel 8y agoCopying will double memory overhead. So downside is easy to see for cloud applications.
- pcwalton 8y agoOnly toy copying GCs are pure semispace collectors.
- ngrilly 8y ago> The most important point, though, is that you don't know whether the hypothesis that Go wouldn't benefit from generational GC is true until you test it. Nobody has tested it. I agree. But you would probably agree it would be a fairly difficult endeavour to test your hypothesis? To make a fair comparison, we'd need to implement an alternative version of the Go compiler and runtime, replacing the current GC with a copying generational GC, with a similar multi-year effort in optimizing and refining it.