In case someone cares about these things, I compared the build times and the binary sizes for 1.9 vs 1.8.3 using the open source project we maintain [1]. This is on a 6-core i7-5280K: Build time with 1.8.3: real 0m7.533s user 0m36.913s sys 0m2.856s Build time with 1.9: real 0m6.830s user 0m35.082s sys 0m2.384s Binary size: 1.8.3 : 19929736 bytes 1.9 : 20004424 bytes So... looks like the multi-threaded compilation ind…
Go 1.9 is released
41–50 of 131 posts
Re: Go 1.9 is released
#42Earlier quoted context omitted.
It could just be one map shared by many goroutines, which normally causes a panic: fatal error: concurrent map writes
Standard practice is to use a mutex to guard against concurrent usage.
Also, do you have any good references to proper best practices around concurrent and parallel programming? (in Go.) Like just basic things. Code I can copy and paste without it having obscure race conditions because that use of mutex is absolutely correct, and something that lets me understand the limitations. I feel like it is very easy to do things "wrong" or not notice some edge cases. In C++ I didn't only ever coded single-threaded for this reason. Too many gotchas. Any help would be appreciated.
Re: Go 1.9 is released
#43Earlier quoted context omitted.
When "type safe" is mentioned without qualification, it almost always refers to static type safety. This is one of those times. So no, the sync.Map container is not typesafe like a regular map is.
According to whom? Certainly not according to wikipedia. Given that it's a pretty big distinction I would think it's on the speaker to be un-ambiguous and say "it's not statically type safe" vs. ambiguous "type safe". I've certainly seen my share of people claiming that "interface{} is just like void * in C" when they speak about Go's (lack of) type safety. I also don't see how insisting on accurate and un-ambiguous…
I would note that the Wikipedia page does not take as strong a position as you seem to imply, reading:
> In the context of static (compile-time) type systems, type safety usually involves (among other things) a guarantee that the eventual value of any expression will be a legitimate member of that expression's static type. The precise requirement is more subtle than this — see, for example, subtype and polymorphism for complications.
Since golang is statically typed, type safety is generally understood to mean static type safety.
Re: Go 1.9 is released
#44Earlier quoted context omitted.
Standard practice is to use a mutex to guard against concurrent usage.
also necessary for reads? Also, do you have any good references to proper best practices around concurrent and parallel programming? (in Go.) Like just basic things. Code I can copy and paste without it having obscure race conditions because that use of mutex is absolutely correct, and something that lets me understand the limitations. I feel like it is very easy to do things "wrong" or not notice some edge cases. In…
Re: Go 1.9 is released
#45Earlier quoted context omitted.
When "type safe" is mentioned without qualification, it almost always refers to static type safety. This is one of those times. So no, the sync.Map container is not typesafe like a regular map is.
According to whom? Certainly not according to wikipedia. Given that it's a pretty big distinction I would think it's on the speaker to be un-ambiguous and say "it's not statically type safe" vs. ambiguous "type safe". I've certainly seen my share of people claiming that "interface{} is just like void * in C" when they speak about Go's (lack of) type safety. I also don't see how insisting on accurate and un-ambiguous…
Re: Go 1.9 is released
#46Please remember that sync.Map isn't type safe and is more optimised for reads.
Re: Go 1.9 is released
#47Earlier quoted context omitted.
This is the biggest problem with Go errors and one of my biggest gripes with the language. Exceptions have stacktraces that give you context about where the error originated. Go errors don't have this and it costs me a lot of time debugging things. https://godoc.org/github.com/pkg/errors helps, but it's still more of a pain than it should be.
Errors can be anything. It's just an interface.
It infuriates me when go proponents try and sweep bad language decisions under the rug with half-fixes.
Re: Go 1.9 is released
#48So this new concurrent map? Am I right in understanding it's designed for cases where you have a map shared between goroutines but where each goroutine essentially owns some subset of the keys in the map? So basically it's designed for cases like 'I have N goroutines and each one owns 1/N keys'?
This lightning talk gives some great information on use cases for the new sync.Map: https://youtu.be/C1EtfDnsdDs
Re: Go 1.9 is released
#49Re: Go 1.9 is released
#50Earlier quoted context omitted.
I really, really don't understand why this would get downvoted. Are people not allowed to ask questions now?
They're discouraged from complaining about downvoting.
Was that interpreted as a complaint as well? Is that the problem?