You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Michael Jones notes that the following pattern is common in Go code:
if v, ok := map[key]; ok { // or !ok
....
map[key] = newValue
}
If hashing that key type is expensive (say: large string/struct) and the map isn't empty
or very small, the above code does it twice.
If we kept a per-P cache of the last key & last computed hash value for that P, we
could eliminate some hash calls.
Probably worth measuring. (Probably not for Go 1.1)