Skip to content

Commit fc66d21

Browse files
author
Junio C Hamano
committed
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>
1 parent 2821104 commit fc66d21

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

diffcore-delta.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@
2626

2727
/* Wild guess at the initial hash size */
2828
#define INITIAL_HASH_SIZE 9
29-
#define HASHBASE 65537 /* next_prime(2^16) */
29+
3030
/* We leave more room in smaller hash but do not let it
3131
* grow to have unused hole too much.
3232
*/
3333
#define INITIAL_FREE(sz_log2) ((1<<(sz_log2))*(sz_log2-3)/(sz_log2))
3434

35+
/* A prime rather carefully chosen between 2^16..2^17, so that
36+
* HASHBASE < INITIAL_FREE(17). We want to keep the maximum hashtable
37+
* size under the current 2<<17 maximum, which can hold this many
38+
* different values before overflowing to hashtable of size 2<<18.
39+
*/
40+
#define HASHBASE 107927
41+
3542
struct spanhash {
3643
unsigned long hashval;
3744
unsigned long cnt;

0 commit comments

Comments
 (0)