use big initial big buffer

This commit is contained in:
Raffael Sahli 2022-05-25 11:48:04 +02:00
parent b5f34caa70
commit ef776ac076
No known key found for this signature in database
GPG key ID: 5E0BF46A67AD81C4

View file

@ -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: