digitalmars.D - The cost of write barriers
- Jonathan Barnard (7/7) Nov 02 2014 The upcoming version 1.4 of Go uses write barriers in preparation
- Araq (5/12) Nov 02 2014 And I think these are meaningless results. You can see here for
- Jonathan Barnard (3/6) Nov 02 2014 Would such an implementation also be possible in a language like
- Araq (3/5) Nov 02 2014 Last time I thought about it, card marking is indeed the only
- thedeemon (7/15) Nov 03 2014 Btw, how are write barriers implemented in Go now?
- Paulo Pinto (6/21) Nov 03 2014 Some information on the upcoming release notes.
- Jonathan Barnard (13/18) Nov 04 2014 It seems it's actually currently just a functional call[1], to
- Paulo Pinto (7/14) Nov 02 2014 Please also mention that those reductions are happening because
- Paulo Pinto (7/23) Nov 02 2014 Ooops, pressed send too soon. :(
- deadalnix (6/13) Nov 03 2014 Write barrier are only required on objects that contain mutable
The upcoming version 1.4 of Go uses write barriers in preparation for the future implementation of a concurrent and generational GC. On the mailing list thread discussing the beta (https://groups.google.com/forum/#!topic/golang-nuts/7VAcfULjiB8), a few people note speed reductions of 30-50% in their benchmarks. I think this vindicates to a degree D's decision to avoid garbage collection strategies that require write barriers.
Nov 02 2014
On Sunday, 2 November 2014 at 08:48:46 UTC, Jonathan Barnard wrote:The upcoming version 1.4 of Go uses write barriers in preparation for the future implementation of a concurrent and generational GC. On the mailing list thread discussing the beta (https://groups.google.com/forum/#!topic/golang-nuts/7VAcfULjiB8), a few people note speed reductions of 30-50% in their benchmarks. I think this vindicates to a degree D's decision to avoid garbage collection strategies that require write barriers.And I think these are meaningless results. You can see here for instance what a write barrier can look like: http://psy-lob-saw.blogspot.de/2014/10/the-jvm-write-barrier-card-marking.html
Nov 02 2014
On Sunday, 2 November 2014 at 10:30:21 UTC, Araq wrote:And I think these are meaningless results. You can see here for instance what a write barrier can look like: http://psy-lob-saw.blogspot.de/2014/10/the-jvm-write-barrier-card-marking.htmlWould such an implementation also be possible in a language like Go or D with internal/'thin' pointers?
Nov 02 2014
Would such an implementation also be possible in a language like Go or D with internal/'thin' pointers?Last time I thought about it, card marking is indeed the only write barrier that is not affected by interior pointers. I could be totally wrong though.
Nov 02 2014
On Sunday, 2 November 2014 at 10:36:13 UTC, Jonathan Barnard wrote:On Sunday, 2 November 2014 at 10:30:21 UTC, Araq wrote:Btw, how are write barriers implemented in Go now?And I think these are meaningless results. You can see here for instance what a write barrier can look like: http://psy-lob-saw.blogspot.de/2014/10/the-jvm-write-barrier-card-marking.htmlWould such an implementation also be possible in a language like Go or D with internal/'thin' pointers?Yes, however the compiler needs to know all the places where your code mutates pointers. That means you can't use memcpy to copy some data with pointers into an old object or array. And you can't mutate pointers from C code.
Nov 03 2014
On Monday, 3 November 2014 at 11:50:57 UTC, thedeemon wrote:On Sunday, 2 November 2014 at 10:36:13 UTC, Jonathan Barnard wrote:Some information on the upcoming release notes. http://tip.golang.org/doc/go1.4#implOn Sunday, 2 November 2014 at 10:30:21 UTC, Araq wrote:Btw, how are write barriers implemented in Go now?And I think these are meaningless results. You can see here for instance what a write barrier can look like: http://psy-lob-saw.blogspot.de/2014/10/the-jvm-write-barrier-card-marking.htmlNow it is officially forbidden to just give a Go pointer directly to a C function. It needs to be given as an uintptr, if I am not mistaken.Would such an implementation also be possible in a language like Go or D with internal/'thin' pointers?Yes, however the compiler needs to know all the places where your code mutates pointers. That means you can't use memcpy to copy some data with pointers into an old object or array. And you can't mutate pointers from C code.
Nov 03 2014
On Monday, 3 November 2014 at 11:50:57 UTC, thedeemon wrote:Btw, how are write barriers implemented in Go now?It seems it's actually currently just a functional call[1], to simulate the performance cost of a write barrier. This is to smooth out the performance drop across multiple releases, rather than a single release bearing the full brunt of the write barrier's introduction. 1.https://code.google.com/p/go/source/browse/src/runtime/mgc0.go?name=default&r=f98b2e08a26867096c2dc78c5283097effcfa0ec#86 On Tuesday, 4 November 2014 at 06:09:21 UTC, deadalnix wrote:Write barrier are only required on objects that contain mutable pointer and are shared. in D, that is a subset of the shared heap. D's type system would allow to use such strategy while mitigating the cost quite a lot.Are there plans to take advantage of this? I've lost track of where the current GC effort is heading; is it focused on integrating the recent D2 port of that parallel collector, or on improving the current collector, or on pervasive reference counting?
Nov 04 2014
On Sunday, 2 November 2014 at 08:48:46 UTC, Jonathan Barnard wrote:The upcoming version 1.4 of Go uses write barriers in preparation for the future implementation of a concurrent and generational GC. On the mailing list thread discussing the beta (https://groups.google.com/forum/#!topic/golang-nuts/7VAcfULjiB8), a few people note speed reductions of 30-50% in their benchmarks. I think this vindicates to a degree D's decision to avoid garbage collection strategies that require write barriers.Please also mention that those reductions are happening because the new code hasn't been optimized yet and Go 1.5 will get a concurrent generational GC. -- Paulo
Nov 02 2014
On Sunday, 2 November 2014 at 13:13:17 UTC, Paulo Pinto wrote:On Sunday, 2 November 2014 at 08:48:46 UTC, Jonathan Barnard wrote:Ooops, pressed send too soon. :( I just wanted to mention the part that Go team is aware that the code still hasn't been fully optimized. Sorry for the second part of the sentence. You did mentioned it. -- PauloThe upcoming version 1.4 of Go uses write barriers in preparation for the future implementation of a concurrent and generational GC. On the mailing list thread discussing the beta (https://groups.google.com/forum/#!topic/golang-nuts/7VAcfULjiB8), a few people note speed reductions of 30-50% in their benchmarks. I think this vindicates to a degree D's decision to avoid garbage collection strategies that require write barriers.Please also mention that those reductions are happening because the new code hasn't been optimized yet and Go 1.5 will get a concurrent generational GC. -- Paulo
Nov 02 2014
On Sunday, 2 November 2014 at 08:48:46 UTC, Jonathan Barnard wrote:The upcoming version 1.4 of Go uses write barriers in preparation for the future implementation of a concurrent and generational GC. On the mailing list thread discussing the beta (https://groups.google.com/forum/#!topic/golang-nuts/7VAcfULjiB8), a few people note speed reductions of 30-50% in their benchmarks. I think this vindicates to a degree D's decision to avoid garbage collection strategies that require write barriers.Write barrier are only required on objects that contain mutable pointer and are shared. in D, that is a subset of the shared heap. D's type system would allow to use such strategy while mitigating the cost quite a lot.
Nov 03 2014
On Tuesday, 4 November 2014 at 06:09:21 UTC, deadalnix wrote:Write barrier are only required on objects that contain mutable pointer and are shared.Required for what exactly? If you want generational GC, you'll need barriers everywhere, not only in shared heap.
Nov 04 2014
On Tuesday, 4 November 2014 at 10:09:47 UTC, thedeemon wrote:On Tuesday, 4 November 2014 at 06:09:21 UTC, deadalnix wrote:Ok I see, I was think about write barrier for concurrent collection. Sorry for the confusion.Write barrier are only required on objects that contain mutable pointer and are shared.Required for what exactly? If you want generational GC, you'll need barriers everywhere, not only in shared heap.
Nov 04 2014