From 3475ec7f36b68126310878e611c8594514b98438 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Mon, 11 May 2015 11:24:10 +1200 Subject: [PATCH] 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/9913 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/cmd/internal/ld/lib.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cmd/internal/ld/lib.go b/src/cmd/internal/ld/lib.go index edafaebb0b..e4e68eae27 100644 --- a/src/cmd/internal/ld/lib.go +++ b/src/cmd/internal/ld/lib.go @@ -1573,12 +1573,11 @@ func Cflush() { } func Cpos() int64 { - Cflush() off, err := coutbuf.f.Seek(0, 1) if err != nil { Exitf("seeking in output [0, 1]: %v", err) } - return off + return off + int64(coutbuf.Buffered()) } func Cseek(p int64) { -- 2.48.1