]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/*: only call ctx.Bso.Flush when something has been written
authorDave Cheney <dave@cheney.net>
Wed, 24 Aug 2016 10:44:09 +0000 (20:44 +1000)
committerDave Cheney <dave@cheney.net>
Thu, 25 Aug 2016 01:31:17 +0000 (01:31 +0000)
commit3167ff7ca91b56f3d06c5cda371b2a7c2741cd35
tree60fc5de8afc034a8d2e74e9084f77d81d723d51c
parent1472221a774c2a763dbe545b1686f4e8dc23613f
cmd/internal/*: only call ctx.Bso.Flush when something has been written

In many places where ctx.Bso.Flush is used as the target for some debug
logging, ctx.Bso.Flush is called unconditionally. In the majority of
cases where debug logging is not enabled, this means Flush is called
many times when there is nothing to be flushed (it will be called anyway
when ctx.Bso is eventually closed), sometimes in a loop.

Avoid this by moving the ctx.Bso.Flush call into the same condition
block as the debug print. This pattern was previously applied
sporadically.

Change-Id: I0444cb235cc8b9bac51a59b2e44e59872db2be06
Reviewed-on: https://go-review.googlesource.com/27579
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
14 files changed:
src/cmd/internal/obj/arm64/obj7.go
src/cmd/internal/obj/mips/obj0.go
src/cmd/internal/obj/ppc64/obj9.go
src/cmd/internal/obj/s390x/objz.go
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/arm/asm.go
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/mips64/asm.go
src/cmd/link/internal/ppc64/asm.go
src/cmd/link/internal/s390x/asm.go
src/cmd/link/internal/x86/asm.go