-
Notifications
You must be signed in to change notification settings - Fork 546
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
performance of count #143
Comments
func (m ConcurrentMap[K, V]) Count() int {
count := 0
for i := 0; i < SHARD_COUNT; i++ {
shard := m.shards[i]
shard.RLock()
count += len(shard.items)
shard.RUnlock()
}
return count
} The function |
there's lock in the function ,the benchmark demonstrate it's necessary to separate count instead of count it |
You're right, I read your code, excellent job |
the performance of count is not very good,can use record it instead of calc it?
The text was updated successfully, but these errors were encountered: