cmd/compile: move Type.Maplineno to separate data structure

Relatively few types are ever used as map keys,
so tracking this separately is a net win.

Passes toolstash -cmp.

name       old alloc/op     new alloc/op     delta
Template       55.9MB ± 0%      55.5MB ± 0%  -0.71%        (p=0.000 n=10+10)
Unicode        37.8MB ± 0%      37.7MB ± 0%  -0.27%        (p=0.000 n=10+10)
GoTypes         180MB ± 0%       179MB ± 0%  -0.52%         (p=0.000 n=7+10)
Compiler        806MB ± 0%       803MB ± 0%  -0.41%        (p=0.000 n=10+10)

CPU and number of allocs are unchanged.

Change-Id: I6d60d74a4866995a231dfed3dd5792d75d904292
Reviewed-on: https://go-review.googlesource.com/21622
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2016-04-06 14:12:48 -07:00
parent d636d7907c
commit 007b12977a
4 changed files with 12 additions and 10 deletions

View file

@ -390,8 +390,8 @@ func checkMapKeyType(key *Type) {
// before key is fully defined, the error
// will only be printed for the first one.
// good enough.
if key.Maplineno == 0 {
key.Maplineno = lineno
if maplineno[key] == 0 {
maplineno[key] = lineno
}
}
}