Selaa lähdekoodia

fix/optimize initial hash table size for borg check

initial size should be so that the hash table does not need resizing -
it must always stay below the MAX_LOAD_FACTOR.
Thomas Waldmann 9 vuotta sitten
vanhempi
sitoutus
409ab9f612
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      borg/archive.py

+ 1 - 1
borg/archive.py

@@ -826,7 +826,7 @@ class ArchiveChecker:
         """
         # Explicitly set the initial hash table capacity to avoid performance issues
         # due to hash table "resonance"
-        capacity = int(len(self.repository) * 1.2)
+        capacity = int(len(self.repository) * 1.35 + 1)  # > len * 1.0 / HASH_MAX_LOAD (see _hashindex.c)
         self.chunks = ChunkIndex(capacity)
         marker = None
         while True: