go/src/cmd
Keith Randall 89c2f282dc cmd/compile: move []byte->string map key optimization to ssa
If we call slicebytetostring immediately (with no intervening writes)
before calling map access or delete functions with the resulting
string as the key, then we can just use the ptr/len of the
slicebytetostring argument as the key. This avoids an allocation.

Fixes #44898
Update #71132

There's old code in cmd/compile/internal/walk/order.go that handles
some of these cases.

1. m[string(b)]
2. s := string(b); m[s]
3. m[[2]string{string(b1),string(b2)}]

The old code handled cases 1&3. The new code handles cases 1&2.
We'll leave the old code around to keep 3 working, although it seems
not terribly common.

Case 2 happens particularly after inlining, so it is pretty common.

Change-Id: I8913226ca79d2c65f4e2bd69a38ac8c976a57e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/640656
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-13 13:03:07 -08:00
..
addr2line
api cmd/api: report error in test instead of crashing 2025-01-14 10:06:18 -08:00
asm cmd/internal/obj/riscv: update references to RISC-V specification 2025-02-07 02:19:17 -08:00
buildid
cgo cmd: use cmd/internal/hash.New32 and Sum32 only 2025-02-13 12:34:30 -08:00
compile cmd/compile: move []byte->string map key optimization to ssa 2025-02-13 13:03:07 -08:00
covdata all: remove coverageredesign experiment 2025-02-03 12:10:28 -08:00
cover
dist cmd/dist: test GOFIPS140=latest rather than just the GODEBUG 2025-02-13 02:49:33 -08:00
distpack
doc cmd/doc: add support for starting pkgsite instance for docs 2025-02-03 09:26:03 -08:00
fix all: replace reflect.Value.Type.Kind with reflect.Value.Kind 2025-02-03 10:30:40 -08:00
go cmd/go: do not apply kill timeout to go test with -bench 2025-02-13 09:51:00 -08:00
gofmt
internal cmd: use cmd/internal/hash.New32 and Sum32 only 2025-02-13 12:34:30 -08:00
link cmd: use cmd/internal/hash.New32 and Sum32 only 2025-02-13 12:34:30 -08:00
nm
objdump cmd: use cmd/internal/hash.New32 and Sum32 only 2025-02-13 12:34:30 -08:00
pack
pprof cmd/internal/objfile: break out dissassemblers to another package 2024-12-11 08:53:20 -08:00
preprofile cmd/preprofile: correct -V flag 2024-11-27 21:27:58 +00:00
relnote
test2json
tools
trace internal/trace: interpret string ID arguments for experimental events 2025-02-11 11:23:31 -08:00
vendor cmd/pprof: update vendored github.com/google/pprof [generated] 2025-02-12 20:49:10 -08:00
vet vet: add regression test for printf checker regression 2025-02-12 11:18:11 -08:00
README.vendor
go.mod cmd/pprof: update vendored github.com/google/pprof [generated] 2025-02-12 20:49:10 -08:00
go.sum cmd/pprof: update vendored github.com/google/pprof [generated] 2025-02-12 20:49:10 -08:00

README.vendor

See src/README.vendor for information on loading vendored packages
and updating the vendor directory.