fix: pre-allocate certain slices with expected capacity (#12044)

Avoids append() based tiny allocations on known
allocated slices repeated access.
This commit is contained in:
Harshavardhana
2021-04-12 13:45:06 -07:00
committed by GitHub
parent f1bc857f66
commit e85b28398b
4 changed files with 16 additions and 12 deletions

View File

@@ -612,7 +612,7 @@ func (s *erasureSets) StorageInfo(ctx context.Context) (StorageInfo, []error) {
storageInfo.Disks = append(storageInfo.Disks, lstorageInfo.Disks...)
}
var errs []error
errs := make([]error, 0, len(s.sets)*s.setDriveCount)
for i := range s.sets {
errs = append(errs, storageInfoErrs[i]...)
}