It did tons of write syscalls before:
https://www.youtube.com/watch?v=t60fhjAqBdw
This is the worst offender. It's not worth fixing all the cases of two
consecutive prints.
Change-Id: I95860ef6a844d89b149528195182b191aad8731b
Reviewed-on: https://go-review.googlesource.com/2371
Reviewed-by: Rob Pike <r@golang.org>
package main
import (
+ "bufio"
"bytes"
"flag"
"fmt"
}
func printUsage(w io.Writer) {
- tmpl(w, usageTemplate, commands)
+ bw := bufio.NewWriter(w)
+ tmpl(bw, usageTemplate, commands)
+ bw.Flush()
}
func usage() {