From 69b5fe0cc7da80d374413d72892507d5e5ecaabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Sun, 11 Jan 2015 16:33:01 +0100 Subject: [PATCH] Optimize: buffer stdout for 2-3x speedup --- xxd.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xxd.go b/xxd.go index 6d8e730..d6c0952 100644 --- a/xxd.go +++ b/xxd.go @@ -18,7 +18,9 @@ func main() { panic(err) } defer f.Close() - if err := XXD(f, os.Stdout); err != nil { + out := bufio.NewWriter(os.Stdout) + defer out.Flush() + if err := XXD(f, out); err != nil { panic(err) } }