News for hackers. Stuff that matters.
Re:Go 1.1 performance improvements by cwzwarich on Monday May 20, 2013 @09:35PM (#5741374)
When will Go have a completely precise garbage collector? In 2013 it seems like poor form to have automatic memory management that isn't asymptotically safe-for-space.
Re:Go 1.1 performance improvements by songgao on Monday May 20, 2013 @11:41PM (#5741776)
Check this out: https://github.com/songgao/bufferManager.go

Not a precise GC, but will be really helpful in some scenarios.

Re:Go 1.1 performance improvements by vanderZwan on Tuesday May 21, 2013 @07:32AM (#5742958)
Have you updated the benchmarks with Go 1.1? How does it compare to other buffer packages?

http://godoc.org/github.com/cznic/bufs

http://godoc.org/github.com/kotokoko/chihaya/bufferpool

Re:Go 1.1 performance improvements by songgao on Tuesday May 21, 2013 @12:16PM (#5744669)
This one is not exactly "buffer" as shown in the two links. It uses a custom structure data type instead of []byte, to avoid conversion between actual data and []byte (marshaling) or type assertion (conversion from/to interface{}). Check https://github.com/songgao/bufferManager.go/blob/master/buff... , inside Data there can be anything. The internal implementation is closer to `bufferpool` (2nd one) though, since they both use a channel as the pool.

As to performance in GO 1.1, I did try it with this implementation but have not updated result to Github. The speedup is similar. You could simply clone the repo and run `run_test.sh` yourself :-)

Re:Go 1.1 performance improvements by vanderZwan on Tuesday May 21, 2013 @01:51PM (#5745392)
Very clear answer!

Apologies for being lazy and just thinking "ooh, buffer, like the other packages with the name buffer" without digging into the sources, and thanks for answering anyway :)

Re:Go 1.1 performance improvements by Groxx on Monday May 20, 2013 @11:31PM (#5741753)
I assume there are tradeoffs? Or are precise garbage collectors simply better everywhere (except maybe complexity)?
Re:Go 1.1 performance improvements by cwzwarich on Monday May 20, 2013 @11:38PM (#5741767)
They're better everywhere except complexity. The two main things that add to the complexity in Go's case are:

1) Existing compilers. Both GCC and LLVM don't precisely track object pointers throughout code generation.

2) Existing FFIs. If you expose an FFI that allows object pointers leak to C code without anything to anchor them as a root then you lock yourself into a conservative GC.

Re:Go 1.1 performance improvements by cmccabe on Tuesday May 21, 2013 @03:41AM (#5742357)
I'm pretty sure that the existing conservative GC in cgo doesn't even scan the C part of the heap, so if you try to use unanchored pointers to Go objects, you will crash. More details here, in the comments: https://code.google.com/p/go/source/browse/misc/cgo/gmp/gmp....

I'm not sure how gccgo does it. There may be some limitations there based on the gcc internals, but I don't see why that would prevent cgo from developing a precise collector.

Re:Go 1.1 performance improvements by cwzwarich on Tuesday May 21, 2013 @10:38AM (#5743891)
It wasn't obvious to me looking at the source of te actual GC implementatiob whether it avoids the C stack frames between Go frames. If it does then they don't have much to worry about.
Re:Go 1.1 performance improvements by cmccabe on Tuesday May 21, 2013 @10:22PM (#5748436)
I'm not sure about stack frames, but I do remember a lot of discussion about golang using a single contiguous area of virtual memory for its heap. Since C wouldn't be using that same address range, there would be no potential issues where someone would put a Go object on the C heap for a long time and have that result in implicit GC pinning. C stack frames may be an issue (I haven't checked either) but only for upcalls from C, which seem rare.