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
standardization - Libraries can more easily inter-operate if there is a standard multimap type. Rust and C++ offer standard multimap implementations, demonstrating the need/demand for this type.
correctness - Implementation of multimap is non-trivial. Providing a standard implementation reduces the risk of bugs introduced by poor multimap implementations.
performance - A multimap structure using existing primitives (eg. maps and slices) is likely to be sub-optimal because of redundant locking. Creating a first-class multimap type allows for a more efficient implementation using unsafe primitives.
Reference implementation:
The following is a reference implementation using existing (map + mutex) primitives:
TL;DR; Add a first-class multimap to
x/sync
Why do we need a specific primitive for
multimap
?multimap
is non-trivial. Providing a standard implementation reduces the risk of bugs introduced by poormultimap
implementations.multimap
type allows for a more efficient implementation using unsafe primitives.Reference implementation:
The following is a reference implementation using existing (map + mutex) primitives:
https://go-review.googlesource.com/c/sync/+/517955
The text was updated successfully, but these errors were encountered: