]> Cypherpunks repositories - gostls13.git/commit
internal/runtime/maps: reuse deleted slots on insert
authorMichael Pratt <mpratt@google.com>
Fri, 4 Oct 2024 19:20:48 +0000 (15:20 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 28 Oct 2024 20:34:48 +0000 (20:34 +0000)
commitefa43c57b109582d602eeb9b5fb690d38e4cf9aa
tree22f4fda23d6334c119d565b7382d0acb2c284eed
parent7de87ebd59f7667f6b27d635a380ea0d9d3dabf5
internal/runtime/maps: reuse deleted slots on insert

While walking the probe sequence, Put keeps track of the first deleted
slot it encountered. If it reaches the end of the probe sequence without
finding a match, then it will prefer to use the deleted slot rather than
a new empty slot.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I19356ef6780176506f57b42990ac15dc426f1b14
Reviewed-on: https://go-review.googlesource.com/c/go/+/618016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/internal/runtime/maps/export_test.go
src/internal/runtime/maps/map.go
src/internal/runtime/maps/map_test.go
src/internal/runtime/maps/table.go