diff options
| author | Michael Pratt <mpratt@google.com> | 2024-09-12 10:44:38 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-10-30 14:07:22 +0000 |
| commit | 3b424cfa9d2704a283bdba544497daad0d47fb65 (patch) | |
| tree | f76053ce29f77f5f0e62ba2c73be4e197c5e9388 /src/runtime/panic.go | |
| parent | 89d7f031720c999e8226cd9624cc2c531f8477e3 (diff) | |
| download | go-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/runtime/panic.go')
| -rw-r--r-- | src/runtime/panic.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go index f97f1c6a66..e66f5ae942 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -1043,6 +1043,11 @@ func fips_fatal(s string) { fatal(s) } +//go:linkname maps_fatal internal/runtime/maps.fatal +func maps_fatal(s string) { + fatal(s) +} + // throw triggers a fatal error that dumps a stack trace and exits. // // throw should be used for runtime-internal fatal errors where Go itself, |
