3 ms·
> so long as you are just setting a new value The hash map first needs to determine whether it already has a value with such a key or not, which requires some
by tagrun 11y ago
> so long as you are just setting a new value
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.