]> granicus.if.org Git - apache/commitdiff
Jean-Jacques is reporting that this change dramatically improves the
authorBill Stoddard <stoddard@apache.org>
Tue, 4 Jun 2002 20:33:15 +0000 (20:33 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 4 Jun 2002 20:33:15 +0000 (20:33 +0000)
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 <jjclar@novell.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95512 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/cache_hash.c

index 36a245c14f9914fabcc93935200b873d8ecbe886..693420dc87dd7e01b8fdbcdb2177cd7700c3584f 100644 (file)
@@ -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 &&