Closed
Description
Per #17973, RWMutex
has some scaling issues. One option is to fix RWMutex
, but for maps with high read:write ratios we can often do better with a carefully-managed atomic.Value
anyway. The standard library contains many such maps, especially in the reflect
package.
The actual details of such a map are a bit subtle to implement correctly and efficiently. We should provide a Map implementation in the standard library. Since the implementation may need to use both sync
and sync/atomic
and the former depends on the latter, it should either go in sync
or in a new, separate sync
subpackage.
(Presumably this should be targeted to 1.9 due to the 1.8 freeze, but I'd like to add a draft API to x/sync
in the meantime.)