]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: don't read symbol name if not needed
authorCherry Zhang <cherryyz@google.com>
Fri, 7 Feb 2020 16:02:42 +0000 (11:02 -0500)
committerCherry Zhang <cherryyz@google.com>
Fri, 7 Feb 2020 20:50:06 +0000 (20:50 +0000)
commitab1253b59ae7bfe5a064bf299bc896a65cc5a027
tree100ba82b6a18d58d65f388bbad80eafd423a1e20
parent38437ce118e60ff562406a771802e3ed466bd789
[dev.link] cmd/link: don't read symbol name if not needed

Most of the time of goobj2.Sym.Read is spent in reading the
symbol name. Sometimes the name is not needed, so don't read
it.

This brings the linking time pretty much back to the old linker.
On my Mac,

$ time go build cmd/compile     # (new)

real 0m1.016s
user 0m1.164s
sys 0m0.297s

$ time go-tip build cmd/compile # (old)

real 0m0.980s
user 0m1.229s
sys 0m0.309s

Again, this is a bit ugly. Maybe we want to consider moving
symbol names out of Sym, to a separate section of the object
file?

Change-Id: Ia9085c15aa4d614b7eae126e71a79d6806c75055
Reviewed-on: https://go-review.googlesource.com/c/go/+/218480
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/internal/goobj2/objfile.go
src/cmd/link/internal/loader/loader.go