Reuse small buffers (#12948)

When reading metadata allow reuse of buffers 
in certain cases. Take the low-hanging fruit.

Reduce GC overhead when listing.
This commit is contained in:
Klaus Post
2021-08-12 23:27:22 +02:00
committed by GitHub
parent 3eac02f676
commit 89febdb3d6
5 changed files with 34 additions and 14 deletions

View File

@@ -76,6 +76,7 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
// Use a small block size to start sending quickly
w := newMetacacheWriter(wr, 16<<10)
w.reuseBlocks = true // We are not sharing results, so reuse buffers.
defer w.Close()
out, err := w.stream()
if err != nil {