News for hackers. Stuff that matters.
Re:Proposed New Go GC: Transaction-Oriented Collector by justin_vanw on Friday June 24, 2016 @12:35PM (#11971173)
If you replace 'transaction' with 'stack'...
Re:Proposed New Go GC: Transaction-Oriented Collector by giovannibajo1 on Friday June 24, 2016 @01:21PM (#11971661)
Go already allocates on the stack anything it can prove it doesn't leave it. I don't see much work going on on escape analysis and I hope they will improve it.

There was a promising proposal document, with a couple of interesting goals, but I guess it was abandoned: https://docs.google.com/document/d/1CxgUBPlx9iJzkz9JWkb6tIpT...

Re:Proposed New Go GC: Transaction-Oriented Collector by twotwotwo on Friday June 24, 2016 @02:23PM (#11972171)
Nah, some of those things went in. I remember seeing a change to keep small string/byte slices' bytes and the smallest size map on the stack sometimes now, for example. https://twitter.com/golang_cls posts a selection of change discussions if you like this kind of stuff. The test/escape_* tests in the Go source tree show what escape analysis is expected to do and not do. Dmitry Vyukov, the author of the doc you linked, worked on a lot of the changes he was talking about; impressed with the range of his contributions (also including the race checker and go-fuzz).
Re:Proposed New Go GC: Transaction-Oriented Collector by uluyol on Friday June 24, 2016 @12:56PM (#11971425)
Plenty of things in C++ are heap allocated. When you create a vector or dynamic string, it isn't allocated on the stack. Yes RAII would still take care of it but that's a separate thing.
Re:Proposed New Go GC: Transaction-Oriented Collector by vvanders on Friday June 24, 2016 @01:48PM (#11971896)
At the risk of sounding a bit pedantic a vector or string isn't required to be on the heap.

You can use either a fixed size arena allocator, or one using alloca(you better know what you're doing) and still allocate those things on the stack.

In cases where you know the bounds of your input and runtime constraints you can get some really incredible performance boosts(multi-orders of mag) with those approaches.

Re:Proposed New Go GC: Transaction-Oriented Collector by Jweb_Guru on Friday June 24, 2016 @02:12PM (#11972082)
Additionally, in C++ strings of less than 23 (IIRC) bytes are not heap allocated (they reuse fields in the existing structure). Whether this is a good thing is a matter of opinion, of course.
Re:Proposed New Go GC: Transaction-Oriented Collector by masklinn on Friday June 24, 2016 @03:56PM (#11972929)
> Additionally, in C++ strings of less than 23 (IIRC) bytes are not heap allocated (they reuse fields in the existing structure).

Not quite. SSO is a lib-specific optimisation. LLVM's libc++ has a 22 characters SSO[0], recent MSVC and recent GNU libstdc++ have 15 characters SSO, Apache and older libstdc++ didn't have SSO at all (and used COW).

The SSO-23 POC/proposal does provide a 23-characters SSO for a 24 bytes string structure (such as LLVM's, MSVC 2013 and modern G++ strings are 32 bytes and SSO-23's scheme provides space for 31 characters in the same stack space).

[0] all capacities exclude the final NUL as it's required and unusable outside of C compatibility

Re:Proposed New Go GC: Transaction-Oriented Collector by vvanders on Friday June 24, 2016 @12:52PM (#11971375)
And if you had move semantics for values 'published' from a goroutine...