-
Notifications
You must be signed in to change notification settings - Fork 543
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 issues during traversal #100
Comments
// return items to the outside
// When external traversal, it is helpful to reduce heap memory allocation
// When the external traversal is very frequent, the external traversal by itself will have better performance than using IterBuffered()
//use example:
// for _, shard := cmap {
// shard.RLock()
// for _, val := range shard.GetItems() {
// //to do something...
// }
// shard.RUnlock()
// }
func (m ConcurrentMapShared) GetItems() map[string]interface{} {
return m.items
} |
@big-uncle i would strongly discourage that get items method. i had a similar method in my program and it wreaked havoc on my garbage collector. the absolute best bet is to use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When we are traversing frequently, using IterBuffered() will generate a lot of memory garbage, which will cause a lot of burden on the GC of the program. At this time, we need to traverse externally, so we have to provide the items method
The text was updated successfully, but these errors were encountered: