Since the tabwriter is flushed at every symbol,
it can be re-used with no impact on the output.
This cuts allocated space when objdump-ing
the compiler by almost 40%,
and enables further upcoming improvements.
It also speeds up objdump.
name old time/op new time/op delta
ObjdumpCompile 9.22s ± 3% 8.77s ± 3% -4.79% (p=0.000 n=10+9)
Change-Id: Ief114d6c2680a4e762b5f439d3ca8dc7a89b9b27
Reviewed-on: https://go-review.googlesource.com/106978
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
fc = NewFileCache(8)
}
+ tw := tabwriter.NewWriter(bw, 18, 8, 1, '\t', tabwriter.StripEscape)
for _, sym := range d.syms {
symStart := sym.Addr
symEnd := sym.Addr + uint64(sym.Size)
file, _, _ := d.pcln.PCToLine(sym.Addr)
fmt.Fprintf(bw, "TEXT %s(SB) %s\n", sym.Name, file)
- tw := tabwriter.NewWriter(bw, 18, 8, 1, '\t', tabwriter.StripEscape)
if symEnd > end {
symEnd = end
}