Commit 3475ec7f authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Ian Lance Taylor

cmd/internal/ld: change Cpos to not flush the output buffer

DWARF generation appears to assume Cpos is cheap and this makes linking godoc
about 8% faster and linking the standard library into a single shared library
about 22% faster on my machine.

Updates #10571

Change-Id: I3f81efd0174e356716e7971c4f59810b72378177
Reviewed-on: https://go-review.googlesource.com/9913Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 516f0d1c
...@@ -1573,12 +1573,11 @@ func Cflush() { ...@@ -1573,12 +1573,11 @@ func Cflush() {
} }
func Cpos() int64 { func Cpos() int64 {
Cflush()
off, err := coutbuf.f.Seek(0, 1) off, err := coutbuf.f.Seek(0, 1)
if err != nil { if err != nil {
Exitf("seeking in output [0, 1]: %v", err) Exitf("seeking in output [0, 1]: %v", err)
} }
return off return off + int64(coutbuf.Buffered())
} }
func Cseek(p int64) { func Cseek(p int64) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment