Skip to content

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

@SeunghoonBaek

Description

@SeunghoonBaek

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions