aboutsummaryrefslogtreecommitdiff
path: root/src/internal/runtime/maps/runtime.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-09-12 10:44:38 -0400
committerGopher Robot <gobot@golang.org>2024-10-30 14:07:22 +0000
commit3b424cfa9d2704a283bdba544497daad0d47fb65 (patch)
treef76053ce29f77f5f0e62ba2c73be4e197c5e9388 /src/internal/runtime/maps/runtime.go
parent89d7f031720c999e8226cd9624cc2c531f8477e3 (diff)
downloadgo-3b424cfa9d2704a283bdba544497daad0d47fb65.tar.xz
internal/runtime/maps: proper capacity hint handling
When given a hint size, set the initial capacity large enough to avoid requiring growth in the average case. When not given a hint (or given 0), don't allocate anything at all. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I8844fc652b8d2d4e5136cd56f7e78999a07fe381 Reviewed-on: https://go-review.googlesource.com/c/go/+/616457 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/internal/runtime/maps/runtime.go')
-rw-r--r--src/internal/runtime/maps/runtime.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/internal/runtime/maps/runtime.go b/src/internal/runtime/maps/runtime.go
index 9ebfb34b28..0d569de214 100644
--- a/src/internal/runtime/maps/runtime.go
+++ b/src/internal/runtime/maps/runtime.go
@@ -11,6 +11,9 @@ import (
// Functions below pushed from runtime.
+//go:linkname fatal
+func fatal(s string)
+
//go:linkname rand
func rand() uint64