aboutsummaryrefslogtreecommitdiff
path: root/src/internal/runtime/maps/map.go
diff options
context:
space:
mode:
authorkhr@golang.org <khr@golang.org>2024-10-31 10:10:08 -0700
committerKeith Randall <khr@golang.org>2024-11-01 20:10:31 +0000
commit378c48e6c7c9f62c80b4d627302fda978ece2a1d (patch)
tree750ac36f68fdfd8bfee9b2d22172c8f488e18e82 /src/internal/runtime/maps/map.go
parent900578d09c42eef2fa5139246794ac6f3aff2e0a (diff)
downloadgo-378c48e6c7c9f62c80b4d627302fda978ece2a1d.tar.xz
internal/runtime/maps: use matchEmptyOrDeleted instead of matchEmpty
It's a bit more efficient. Change-Id: If813a597516c41fdac6f60e586641d0ee1cde025 Reviewed-on: https://go-review.googlesource.com/c/go/+/623818 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal/runtime/maps/map.go')
-rw-r--r--src/internal/runtime/maps/map.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/internal/runtime/maps/map.go b/src/internal/runtime/maps/map.go
index 262f20f5cb..4643960247 100644
--- a/src/internal/runtime/maps/map.go
+++ b/src/internal/runtime/maps/map.go
@@ -554,9 +554,10 @@ func (m *Map) putSlotSmall(typ *abi.SwissMapType, hash uintptr, key unsafe.Point
match = match.removeFirst()
}
- // No need to look for deleted slots, small maps can't have them (see
- // deleteSmall).
- match = g.ctrls().matchEmpty()
+ // There can't be deleted slots, small maps can't have them
+ // (see deleteSmall). Use matchEmptyOrDeleted as it is a bit
+ // more efficient than matchEmpty.
+ match = g.ctrls().matchEmptyOrDeleted()
if match == 0 {
fatal("small map with no empty slot (concurrent map writes?)")
}