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
(First of all, cool project @puzpuzpuz! A faster and typed concurrent map like MapOf is something that should be part of go's stdlib)
Copy-on-write maps are useful for read-mostly performance-critical areas, as LoadOrCompute() calls only cost an atomic load for reads. Additionally, these semantics provide a snapshot view that allow fast and predictable iteration.
Typical use cases for these structures are config settings and topology management.
I can contribute it, if you think it belongs in this project.
The text was updated successfully, but these errors were encountered:
I'm all for a contribution. COW data structures are on the radar and I have a COW list issue open (#27), but there wasn't enough interest for it, unfortunately. In MapOf, LoadOrCompute()'s read path assumes two atomic loads in the best case. So the end COW map performance might be close to MapOf, but it's certainly worth exploring.
I agree that the improvement on the performance side for read-mostly cases is minor.
I think the main benefit is related to the consistent snapshot semantics: iterate a point-in-time structure, e.g., if you have a map with [a, b, c] keys that get mutated into [a, b, d, e] the caller will never get [a, b, d].
(First of all, cool project @puzpuzpuz! A faster and typed concurrent map like
MapOf
is something that should be part of go's stdlib)Copy-on-write maps are useful for read-mostly performance-critical areas, as
LoadOrCompute()
calls only cost an atomic load for reads. Additionally, these semantics provide a snapshot view that allow fast and predictable iteration.Typical use cases for these structures are config settings and topology management.
I can contribute it, if you think it belongs in this project.
The text was updated successfully, but these errors were encountered: