From 3b424cfa9d2704a283bdba544497daad0d47fb65 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 12 Sep 2024 10:44:38 -0400 Subject: 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 Reviewed-by: Keith Randall Reviewed-by: Keith Randall Auto-Submit: Michael Pratt --- src/runtime/panic.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/runtime/panic.go') 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, -- cgit v1.3-5-g45d5