Alloc less for metacache decompression (#12134)

Network streams are limited to 16K blocks. Don't alloc more upfront.

Signed-off-by: Klaus Post <klauspost@gmail.com>
This commit is contained in:
Klaus Post 2021-04-23 19:27:42 +02:00 committed by GitHub
parent bb1198c2c6
commit e0d3a8c1f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -230,7 +230,8 @@ func (w *metacacheWriter) Reset(out io.Writer) {
}
var s2DecPool = sync.Pool{New: func() interface{} {
return s2.NewReader(nil)
// Default alloc block for network transfer.
return s2.NewReader(nil, s2.ReaderAllocBlock(16<<10))
}}
// metacacheReader allows reading a cache stream.