From 5cb47cbedda7e4800679d36ddb416b9b7e40bb51 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 14 Jan 2016 03:56:12 +0100 Subject: [PATCH] hashindex: explain hash_sizes --- borg/_hashindex.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/borg/_hashindex.c b/borg/_hashindex.c index 247454d26..f1aa0aa8c 100644 --- a/borg/_hashindex.c +++ b/borg/_hashindex.c @@ -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,