commit | fa470f6245191b3c2f0b715194edf7cdf951af48 | [log] [tgz] |
---|---|---|
author | Michael Anthony Knyszek <mknyszek@google.com> | Sat Mar 23 01:21:03 2024 +0000 |
committer | Gopher Robot <gobot@golang.org> | Thu Apr 18 21:20:09 2024 +0000 |
tree | a2b0eb774d2358b2c31f3cde7dc6cad011ae7459 | |
parent | 68c0ad3a689833344fada8acc1f36a06c343caa4 [diff] |
internal/concurrent: add HashTrieMap This change adds a concurrent hash-trie map implementation to the standard library in the new internal/concurrent package, intended to hold concurrent data structures. (The name comes from how Java names their concurrent data structure library in the standard library.) This data structure is created specially for the upcoming unique package. It is built specifically around frequent successful lookups and comparatively rare insertions and deletions. A valid question is whether this is worth it over a simple locked map. Some microbenchmarks in this new package show that yes, this extra complexity appears to be worth it. Single-threaded performance for LoadOrStore is comparable to a locked map for a map with 128k small string elements. The map scales perfectly up to 24 cores for Loads, which is the maximum available parallelism on my machine. LoadOrStore operations scale less well. Small maps will have a high degree of contention, but for the unique library, small maps are very unlikely to stay small if there are a lot of inserts, since they have a full GC cycle to grow. For #62483. Change-Id: I38e5ac958d19ebdd0c8c02e36720bb3338fe2e35 Reviewed-on: https://go-review.googlesource.com/c/go/+/573956 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.