From 482e06ead380fb70da15136db5b75d2187beb41d Mon Sep 17 00:00:00 2001
From: "alex.sharov" <AskAlexSharov@gmail.com>
Date: Wed, 13 Apr 2022 16:35:21 +0700
Subject: [PATCH] uncompress: buf fix

---
 turbo/app/snapshots.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/turbo/app/snapshots.go b/turbo/app/snapshots.go
index b5ca8fd160..3e10b916ab 100644
--- a/turbo/app/snapshots.go
+++ b/turbo/app/snapshots.go
@@ -161,12 +161,13 @@ func doUncompress(cliCtx *cli.Context) error {
 		return err
 	}
 	if err := decompressor.WithReadAhead(func() error {
-		wr := bufio.NewWriterSize(os.Stdout, etl.BufIOSize)
+		wr := bufio.NewWriterSize(os.Stdout, 16*etl.BufIOSize)
+		defer wr.Flush()
 		g := decompressor.MakeGetter()
-		var buf []byte
+		buf := make([]byte, 0, 16*etl.BufIOSize)
 		var EOL = []byte("\n")
 		for g.HasNext() {
-			buf, _ := g.Next(buf[:0])
+			buf, _ = g.Next(buf[:0])
 			if _, err := wr.Write(buf); err != nil {
 				return err
 			}
-- 
GitLab