Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest that concurrent-map would use custom shard_count for each instance #136

Open
SeunghoonBaek opened this issue May 4, 2023 · 0 comments

Comments

@SeunghoonBaek
Copy link

Hello, concurrent-map maintainers :)

I accidentally found this concurrent-map repository, which looks very cool!

Me and one of my team members suggested how to use custom SHARD_COUNT for each concurrent map instance instead of global SHARD_COUNT.

It looks like this one.

// A "thread" safe map of type string:Anything.
// To avoid lock bottlenecks this map is dived to several (SHARD_COUNT) map shards.
type ConcurrentMap[K comparable, V any] struct {
	shards     []*ConcurrentMapShared[K, V]
	sharding   func(key K) uint32
	shardCount uint32 // <- THIS IS ADDED
}

I'll submit my source code for it on PR, could you please review my changes?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant