1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-25 00:38:58 +00:00

hashindex: explain hash_sizes

This commit is contained in:
Thomas Waldmann 2016-01-14 03:56:12 +01:00
parent 083f5e31ef
commit 5cb47cbedd

View file

@ -40,7 +40,15 @@ typedef struct {
int upper_limit;
} HashIndex;
/* prime (or w/ big prime factors) hash table sizes - otherwise performance breaks down! */
/* prime (or w/ big prime factors) hash table sizes
* not sure we need primes for borg's usage (as we have a hash function based
* on sha256, we can assume an even, seemingly random distribution of values),
* but OTOH primes don't harm.
* also, growth of the sizes starts with fast-growing 2x steps, but slows down
* more and more down to 1.1x. this is to avoid huge jumps in memory allocation,
* like e.g. 4G -> 8G.
* these values are generated by hash_sizes.py.
*/
static int hash_sizes[] = {
1031, 2053, 4099, 8209, 16411, 32771, 65537, 131101, 262147, 445649,
757607, 1287917, 2189459, 3065243, 4291319, 6007867, 8410991,