Go 1.6 Release Candidate 1 is released
groups.google.com
groups.google.com
No code change, no breakage, just constant free performance.
It should give a nice speed increase and binary size decrease in your programs for free!
The hope is that Go will have enough adoption to require breaking changes!
On the client side, http/2 is awesome for services like spiders that support it because the memory usage and performance is a lot better.
And you don't even have to do anything to take advantage other than upgrade to go 1.6
I know, right! That's what's sick. Even upgrading to the latest version of go is easy: "To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go." Then install the latest...
https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2...
Unofficial theme song: https://www.youtube.com/watch?v=xNat6iJB5So
What if you are writing to a value in the map? Surely that is safe to do concurrently with other processes reading at least.
> What if you are writing to a value in the map? Surely that is safe to do concurrently with other processes reading at least.
Nope. You need to protect your state by communicating with channels or using a lock.
But what are you protecting? Setting a value will not cause a map rebalance, and so long as you are just setting a new value (not incrementing or like) it should be an atomic operation. Locking is really slow, and if you can find safe ways to avoid it, it can be a good thing.
The hash map first needs to determine whether it already has a value with such a key or not, which requires some checking that typically involves many instructions and is not atomic. And to determine that, you at least need a read-lock.
ml.Lock()
v := m["key"] // maybe m is something like map[string]*MyValue
ml.Unlock()
v.foo = "bar" // m["key"].foo is now bar, because m["key"] both point to the same object