cmd/compile, cmd/link: eliminate string merging pass

Deleting the string merging pass makes the linker 30-35% faster
but makes jujud (using the github.com/davecheney/benchjuju snapshot) 2.5% larger.
Two optimizations bring the space overhead down to 0.6%.

First, change the default alignment for string data to 1 byte.
(It was previously defaulting to larger amounts, usually pointer width.)

Second, write out the type string for T (usually a bigger expression) as "*T"[1:],
so that the type strings for T and *T share storage.

Combined, these obtain the bulk of the benefit of string merging
at essentially no cost. The remaining benefit from string merging
is not worth the excessive cost, so delete it.

As penance for making the jujud binary 0.6% larger,
the next CL in this sequence trims the reflect functype
information enough to make the jujud binary overall 0.75% smaller
(that is, that CL has a net -1.35% effect).

For #6853.
Fixes #14648.

Change-Id: I3fdd74c85410930c36bb66160ca4174ed540fc6e
Reviewed-on: https://go-review.googlesource.com/20334
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2016-03-07 22:48:07 -05:00 committed by Brad Fitzpatrick
parent fb880b8a03
commit 21af2d39c2
7 changed files with 35 additions and 166 deletions

View file

@ -357,6 +357,7 @@ const (
STYPE
SSTRING
SGOSTRING
SGOSTRINGHDR
SGOFUNC
SGCBITS
SRODATA
@ -375,6 +376,7 @@ const (
STYPERELRO
SSTRINGRELRO
SGOSTRINGRELRO
SGOSTRINGHDRRELRO
SGOFUNCRELRO
SGCBITSRELRO
SRODATARELRO