]> Cypherpunks repositories - gostls13.git/commit
internal/runtime/maps: optimize small map lookups with int keys
authorMichael Pratt <mpratt@google.com>
Mon, 14 Oct 2024 19:08:27 +0000 (15:08 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 30 Oct 2024 15:31:50 +0000 (15:31 +0000)
commitd51f92e73751fd8fb7455927ecabd85becd13f06
tree050b2fccb0b87fe3f6123dd62c803651921ad2a1
parent0b652e3ef6413b343d0e7ee38a58f1cc15c933f6
internal/runtime/maps: optimize small map lookups with int keys

Load the field we need from the type once outside the search loop.
Get rid of the multiply to compute the slot position. Instead compute
the slot position incrementally using addition.
Move the hashing later in access2.

Based on khr@'s CL 618959.

For #54766.

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