From ef776ac076c6a65a6492c14570dbf8e76fa53110 Mon Sep 17 00:00:00 2001 From: Raffael Sahli Date: Wed, 25 May 2022 11:48:04 +0200 Subject: [PATCH] use big initial big buffer --- pkg/resource/stream.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/resource/stream.go b/pkg/resource/stream.go index 8186d53..0519fdc 100644 --- a/pkg/resource/stream.go +++ b/pkg/resource/stream.go @@ -47,12 +47,10 @@ func FromStream(ctx context.Context, path string, r io.Reader) (<-chan Resource, errors := make(chan error) go func() { - const initialBufSize = 4 * 1024 * 1024 // Start with 4MB - const maxBufSize = 256 * 1024 * 1024 // Start with 4MB - + const maxBufSize = 256 * 1024 * 1024 scanner := bufio.NewScanner(r) - buf := make([]byte, initialBufSize) - scanner.Buffer(buf, maxBufSize) // Resize up to 256MB + buf := make([]byte, maxBufSize) + scanner.Buffer(buf, maxBufSize) scanner.Split(SplitYAMLDocument) SCAN: