]> Cypherpunks repositories - gostls13.git/commit
internal/runtime/maps: use simpler calculation for slot element
authorKeith Randall <khr@golang.org>
Tue, 19 Nov 2024 00:12:48 +0000 (16:12 -0800)
committerKeith Randall <khr@golang.org>
Tue, 19 Nov 2024 21:15:38 +0000 (21:15 +0000)
commit253a9933d181ce5e57de81f56d7e50565c423f0f
treebea7f3a61b159fd3f0cd606579ea381a9332ebca
parent2e607475903b9cceacfac6bc900ed8d7e42d4231
internal/runtime/maps: use simpler calculation for slot element

This reduces the adds required at the return point from 3 to 1.
(The multiply inside g.elem() does get CSE'd with the one inside
g.key(), but the rest of the adds don't.)

Instead, compute the element as just a fixed offset from the key.

Change-Id: Ia4d7664efafcdca5e9daeb77d270651bb186232c
Reviewed-on: https://go-review.googlesource.com/c/go/+/629535
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/internal/runtime/maps/runtime_fast32_swiss.go
src/internal/runtime/maps/runtime_fast64_swiss.go
src/internal/runtime/maps/runtime_faststr_swiss.go
src/internal/runtime/maps/runtime_swiss.go