cmd/compile/internal/pgo: use a slice for locations

Currently locations are stored in a map and looked up by ID from
the map. The IDs are usually small sequential integers (the Go
pprof CPU profiles are so). Using a slice is more efficient (with
a fallback map to handle weirdly large IDs).

Change-Id: I9e20d5cebca3a5239636413e1bf2f0b273038031
Reviewed-on: https://go-review.googlesource.com/c/go/+/447803
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Cherry Mui 2022-11-03 21:11:23 -04:00
parent 6d58aea5d4
commit d9cc39b25c
2 changed files with 29 additions and 10 deletions

View file

@ -140,7 +140,7 @@ func New(profileFile string) *Profile {
return nil
}
g, _ := newGraph(profile, &Options{
g := newGraph(profile, &Options{
CallTree: false,
SampleValue: func(v []int64) int64 { return v[1] },
})