fcpat: Increase the number of buckets in the shared string hash table

This is a reasonably conservative increase in the number of buckets in the hash
table to 251.  After FcInit(), there are 240 shared strings in use on my system
(from configuration files I assume).  The hash value is stored in each link in
the chains so comparison are actually not very expensive.  This change should
reduce the average length of chains by a factor of 8.  With the reference
counted strings, it should keep the average length of chains to about 2.  The
number of buckets is prime so as not to rely too much on the quality of the
hash function.

https://bugs.freedesktop.org/show_bug.cgi?id=17832#c5

Patch from Karl Tomlinson
This commit is contained in:
Akira TAGOH 2012-03-28 13:38:53 +09:00
parent d8dcff7b96
commit 4a060729a1
1 changed files with 1 additions and 1 deletions

View File

@ -1023,7 +1023,7 @@ bail0:
return NULL; return NULL;
} }
#define OBJECT_HASH_SIZE 31 #define OBJECT_HASH_SIZE 251
static struct objectBucket { static struct objectBucket {
struct objectBucket *next; struct objectBucket *next;
FcChar32 hash; FcChar32 hash;