From 63f762bcdea96889d8ffa406804665b84bda63ab Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 14 Nov 2024 16:58:07 -0800 Subject: internal/runtime/maps: eliminate a load from the hot path typ.Group.Size involves two loads. Instead cache GroupSize as a separate fields of the map type so we can get to it in just one load. Change-Id: I10ffdce1c7f75dcf448da14040fda78f0d75fd1d Reviewed-on: https://go-review.googlesource.com/c/go/+/627716 Reviewed-by: Cherry Mui Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI --- src/internal/runtime/maps/map.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/internal/runtime/maps/map.go') diff --git a/src/internal/runtime/maps/map.go b/src/internal/runtime/maps/map.go index 86977bbc2d..969da13432 100644 --- a/src/internal/runtime/maps/map.go +++ b/src/internal/runtime/maps/map.go @@ -296,7 +296,7 @@ func NewMap(mt *abi.SwissMapType, hint uintptr, m *Map, maxAlloc uintptr) *Map { if overflow { return m // return an empty map. } else { - mem, overflow := math.MulUintptr(groups, mt.Group.Size_) + mem, overflow := math.MulUintptr(groups, mt.GroupSize) if overflow || mem > maxAlloc { return m // return an empty map. } -- cgit v1.3