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

@@ -663,7 +663,7 @@ func formatErasureV3Check(reference *formatErasureV3, format *formatErasureV3) e
func initErasureMetaVolumesInLocalDisks(storageDisks []StorageAPI, formats []*formatErasureV3) error {
// Compute the local disks eligible for meta volumes (re)initialization
var disksToInit []StorageAPI
disksToInit := make([]StorageAPI, 0, len(storageDisks))
for index := range storageDisks {
if formats[index] == nil || storageDisks[index] == nil || !storageDisks[index].IsLocal() {
// Ignore create meta volume on disks which are not found or not local.