From 17722c21e754f25b7694b350cdae044b9729776c Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Sat, 2 Nov 2019 09:36:28 -0400 Subject: [PATCH] [dev.link] cmd/link/internal/loader: reduce ABI alias postprocessing overhead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In loadObjFull when populating the sym.Reloc vector for live symbols, avoid using the loader.SymType() method to determine if a relocation targets an ABI alias; since invoking loader.SymType requires a global-to-local index translation and a read from the object file. Instead just look at the target symbol itself, which has already been created at this point. Hyperkube performance numbers for this change: name old time/op new time/op delta RelinkHyperkube 29.9s ± 2% 29.2s ± 3% -2.42% (p=0.000 n=20+20) RelinkWithoutDebugHyperkube 22.0s ± 3% 21.4s ± 3% -2.58% (p=0.000 n=20+20) Change-Id: Ib7696d8760dd0485240246d6d640668fbf451d71 Reviewed-on: https://go-review.googlesource.com/c/go/+/205257 Run-TryBot: Than McIntosh TryBot-Result: Gobot Gobot Reviewed-by: Jeremy Faller --- src/cmd/link/internal/loader/loader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go index c0fa5fa7ce2..4fa0d5ddce3 100644 --- a/src/cmd/link/internal/loader/loader.go +++ b/src/cmd/link/internal/loader/loader.go @@ -1058,7 +1058,7 @@ func loadObjFull(l *Loader, r *oReader) { rs = 0 sz = 0 } - if rs != 0 && l.SymType(rs) == sym.SABIALIAS { + if rs != 0 && l.Syms[rs] != nil && l.Syms[rs].Type == sym.SABIALIAS { rsrelocs := l.Relocs(rs) rs = rsrelocs.At(0).Sym }