mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
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:
@@ -1082,6 +1082,7 @@ func (s *xlStorage) ReadVersion(ctx context.Context, volume, path, versionID str
|
||||
err = osErrToFileErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == errFileNotFound {
|
||||
if err = s.renameLegacyMetadata(volumeDir, path); err != nil {
|
||||
@@ -1120,6 +1121,13 @@ func (s *xlStorage) ReadVersion(ctx context.Context, volume, path, versionID str
|
||||
return fi, err
|
||||
}
|
||||
|
||||
if len(fi.Data) == 0 && cap(buf) >= metaDataReadDefault && cap(buf) < metaDataReadDefault*4 {
|
||||
// We did not read inline data, so we have no references.
|
||||
defer func(b []byte) {
|
||||
metaDataPool.Put(buf)
|
||||
}(buf)
|
||||
}
|
||||
|
||||
if readData {
|
||||
if len(fi.Data) > 0 || fi.Size == 0 {
|
||||
if len(fi.Data) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user