aboutsummaryrefslogtreecommitdiff
path: root/diffcore-delta.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-12 20:32:06 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-12 20:42:12 -0800
commitfc66d213f8b2f13b9ffd643f01de25ddc95e0972 (patch)
tree340b074082effe5b0892cf67db309dd6fab3e1f8 /diffcore-delta.c
parent2821104db7fabdfac105ae757228b0eac107047c (diff)
downloadgit-fc66d213f8b2f13b9ffd643f01de25ddc95e0972.tar.gz
git-fc66d213f8b2f13b9ffd643f01de25ddc95e0972.tar.xz
diffcore-delta: tweak hashbase value.
This tweaks the maximum hashvalue we use to hash the string into without making the maximum size of the hashtable can grow from the current limit. With this, the renames detected becomes a bit more precise without incurring additional paging cost. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diffcore-delta.c')
-rw-r--r--diffcore-delta.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/diffcore-delta.c b/diffcore-delta.c
index f8a751837..835d82c99 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -26,12 +26,19 @@
/* Wild guess at the initial hash size */
#define INITIAL_HASH_SIZE 9
-#define HASHBASE 65537 /* next_prime(2^16) */
+
/* We leave more room in smaller hash but do not let it
* grow to have unused hole too much.
*/
#define INITIAL_FREE(sz_log2) ((1<<(sz_log2))*(sz_log2-3)/(sz_log2))
+/* A prime rather carefully chosen between 2^16..2^17, so that
+ * HASHBASE < INITIAL_FREE(17). We want to keep the maximum hashtable
+ * size under the current 2<<17 maximum, which can hold this many
+ * different values before overflowing to hashtable of size 2<<18.
+ */
+#define HASHBASE 107927
+
struct spanhash {
unsigned long hashval;
unsigned long cnt;