mirror of
https://github.com/golang/go.git
synced 2025-05-13 19:34:38 +00:00
Change-Id: If9e3c5a58726ae3628d2e835d71f1a4708594c11 Reviewed-on: https://go-review.googlesource.com/c/go/+/586575 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
14 lines
566 B
Markdown
14 lines
566 B
Markdown
### New unique package
|
|
|
|
The new [unique] package provides facilities for
|
|
canonicalizing values (like "interning" or "hash-consing").
|
|
|
|
Any value of comparable type may be canonicalized with the new
|
|
`Make[T]` function, which produces a reference to a canonical copy of
|
|
the value in the form of a `Handle[T]`.
|
|
Two `Handle[T]` are equal if and only if the values used to produce the
|
|
handles are equal, allowing programs to deduplicate values and reduce
|
|
their memory footprint.
|
|
Comparing two `Handle[T]` values is efficient, reducing down to a simple
|
|
pointer comparison.
|