cmd/link: deduplicate pctab info in pclntab

The existing pclntab construction took care to re-use strings:
filenames and fully qualified function names.

It did not try to deduplicate pctab information,
perhaps because the author assumed that there
wouldn't be much duplication.

This change introduces that deduplication.
The cache gets a 33% hit rate during make.bash.

This doesn't require any changes to the file format,
and shrinks binaries by about 1%.

Updates #6853

file      before    after     Δ        %       
go        14659236  14515876  -143360  -0.978% 
addr2line 4272424   4223272   -49152   -1.150% 
api       6050808   5993464   -57344   -0.948% 
asm       4906416   4869552   -36864   -0.751% 
buildid   2861104   2824240   -36864   -1.288% 
cgo       4859784   4810632   -49152   -1.011% 
compile   25749656  25213080  -536576  -2.084% 
cover     5286952   5229608   -57344   -1.085% 
dist      3634192   3597328   -36864   -1.014% 
doc       4691080   4641928   -49152   -1.048% 
fix       3397960   3361096   -36864   -1.085% 
link      6113568   6064432   -49136   -0.804% 
nm        4221928   4172776   -49152   -1.164% 
objdump   4636600   4587448   -49152   -1.060% 
pack      2281184   2256608   -24576   -1.077% 
pprof     14641204  14485556  -155648  -1.063% 
test2json 2814536   2785864   -28672   -1.019% 
trace     11602204  11487516  -114688  -0.989% 
vet       8399528   8313512   -86016   -1.024% 

Change-Id: I59c6aae522700a0d36ddd2cbca6e22ecdf17eea2
Reviewed-on: https://go-review.googlesource.com/c/go/+/172079
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
1 file changed
tree: 60938962c68eccfe4c1662ba78cafd185b08db6f
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. misc/
  6. src/
  7. test/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. CONTRIBUTING.md
  12. CONTRIBUTORS
  13. favicon.ico
  14. LICENSE
  15. PATENTS
  16. README.md
  17. robots.txt
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.