Skip to content

v1.19.3.240412

Latest
Compare
Choose a tag to compare
@fufuok fufuok released this 12 Apr 03:10

🌈 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](), Used xxhash, 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