From: Bill Stoddard Date: Tue, 4 Jun 2002 20:33:15 +0000 (+0000) Subject: Jean-Jacques is reporting that this change dramatically improves the X-Git-Tag: 2.0.37~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cb51b25ba5ce8bce67774b9dbd3b0c295767c8a;p=apache Jean-Jacques is reporting that this change dramatically improves the distribution in the hash table resulting in a 20% performance boost when caching 6000+ files in a hash table with 512 collision chains. Submitted by: Jean-Jacques Clar git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95512 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/cache_hash.c b/modules/experimental/cache_hash.c index 36a245c14f..693420dc87 100644 --- a/modules/experimental/cache_hash.c +++ b/modules/experimental/cache_hash.c @@ -82,7 +82,7 @@ typedef struct cache_hash_entry_t cache_hash_entry_t; struct cache_hash_entry_t { cache_hash_entry_t *next; - int hash; + unsigned int hash; const void *key; apr_ssize_t klen; const void *val; @@ -203,7 +203,7 @@ static cache_hash_entry_t **find_entry(cache_hash_t *ht, { cache_hash_entry_t **hep, *he; const unsigned char *p; - int hash; + unsigned int hash; apr_ssize_t i; /* @@ -257,7 +257,7 @@ static cache_hash_entry_t **find_entry(cache_hash_t *ht, } /* scan linked list */ - for (hep = &ht->array[hash & ht->max], he = *hep; + for (hep = &ht->array[hash % ht->max], he = *hep; he; hep = &he->next, he = *hep) { if (he->hash == hash &&