-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
sync: enhancement: have the new sync.Map use sharding #20360
Comments
Related #18802 |
CC @bcmills Note that we don't use the issue tracker for questions. This may be better discussed on the golang-dev mailing list. See https://golang.org/wiki/Questions . |
The short answer is, "Yes, we considered it." The longer answer is that (Also note that sharded data structures can sometimes fail dramatically in the case of unlucky shard assignments: for example, see #17953.) That said, the 1.9 implementation almost certainly has room for improvement. The "new key" path in particular would likely benefit from some kind of sharding: at the moment all newly-added keys are guarded by a single If you have a specific workload in mind, I would encourage you to write some benchmarks and see what you can come up with for when the 1.10 window opens. † Except to the extent that the runtime's memory allocator introduces false-sharing by allocating read-only values on the same cache lines as non-read-only values. |
Okay, I guess there's nothing left to do here. Question was answered. Thanks, @bcmills. |
Hi guys,
Was glad to see the new sync.Map code merged into master recently. Did you guys consider using sharding technique such as the one used here to reduce time spent between locks?
Cheers,
Or
The text was updated successfully, but these errors were encountered: