mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
1472221a77
commit
3167ff7ca9
14 changed files with 47 additions and 48 deletions
|
|
@ -145,8 +145,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
|||
*/
|
||||
if ctxt.Debugvlog != 0 {
|
||||
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime())
|
||||
ctxt.Bso.Flush()
|
||||
}
|
||||
ctxt.Bso.Flush()
|
||||
|
||||
var q *obj.Prog
|
||||
var q1 *obj.Prog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue