Skip to content

Commit

Permalink
cmd/internal/ld: change Cpos to not flush the output buffer
Browse files Browse the repository at this point in the history
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 golang#10571

Change-Id: I3f81efd0174e356716e7971c4f59810b72378177
  • Loading branch information
mwhudson committed May 11, 2015
1 parent 2d9a50b commit f25c512
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cmd/internal/ld/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f25c512

Please sign in to comment.