π Concurrent Map
sync.Map with better read and write performance (supports any type of the key)
forked from orcaman/concurrent-map
For cache, you can choose: Cache/CacheOf and Map/MapOf
β¨ Changelog
- Unified initialization method:
cmap.NewOf[K, V]()
, Usedxxhash
, thanks. - For generics: Optionally specify the number of shards to improve performance.
func NewOf[K Hashable, V any](numShards ...int) *MapOf[K, V]
- Supports both generic and non-generic types.
- Add benchmarks for commonly used Map packages, See: π€ Benchmarks
π Tips
ShardCount can also be specified globally, but it must be executed before all Maps are initialized and cannot be modified.
cmap.ShardCount = 128