Changeset 253

Show
Ignore:
Timestamp:
07/29/06 11:44:09 (2 years ago)
Author:
bart
Message:

* Don't use our own hash function, the one from the ZE is extremely much

faster and provides a much better distribution.

* Don't compile the user cache code one no feature is being compiled.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r252 r253  
     12006-07-30  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Don't use our own hash function, the one from the ZE is extremely much 
     4          faster and provides a much better distribution. 
     5        * Don't compile the user cache code one no feature is being compiled. 
     6 
    172006-07-29  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    28 
     
    4046 
    41472006-07-24  Hans Rakers <hans at parse dot nl> 
    42         * Fix for ticket #47 and #63, related to problems restoring empty 
    43           strings and empty string array keys from the disk cache. 
     48            * Fix for ticket #47 and #63, related to problems restoring empty 
     49              strings and empty string array keys from the disk cache. 
    4450 
    45512006-07-23  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     
    78842006-06-30  Hans Rakers <hans at parse dot nl> 
    7985 
    80         * Added ability to sort table columns by clicking on the table 
    81           headings in the control panel 
    82         * Quick & dirty fix for eaccelerator_clear to work with the new 
    83           cache dir hashing. This still needs to be done for win32. 
    84  
    85           eaccelerator_clean still needs some fixing to work with the 
    86           dir hashing. 
     86            * Added ability to sort table columns by clicking on the table 
     87              headings in the control panel 
     88            * Quick & dirty fix for eaccelerator_clear to work with the new 
     89              cache dir hashing. This still needs to be done for win32. 
     90 
     91              eaccelerator_clean still needs some fixing to work with the 
     92              dir hashing. 
    8793 
    88942006-06-27  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
  • eaccelerator/trunk/cache.c

    r237 r253  
    2929#include "eaccelerator_version.h" 
    3030 
    31 #ifdef HAVE_EACCELERATOR 
     31#if defined(HAVE_EACCELERATOR) && (defined(WITH_EACCELERATOR_CONTENT_CACHING) || defined(WITH_EACCELERATOR_SESSIONS) || defined(WITH_EACCELERATOR_SHM)) 
    3232 
    3333#include "zend.h" 
     
    249249        q->size = size; 
    250250        EAG(mem) += offsetof(mm_user_cache_entry, key) + xlen + 1; 
    251         q->hv = hash_mm(xkey, xlen); 
     251        q->hv = zend_get_hash_value(xkey, xlen); 
    252252        memcpy(q->key, xkey, xlen + 1); 
    253253        memcpy(&q->value, val, sizeof(zval)); 
     
    336336 
    337337    xkey = build_key(key, key_len, &xlen TSRMLS_CC); 
    338     hv = hash_mm(xkey, xlen); 
     338    hv = zend_get_hash_value(xkey, xlen); 
    339339    slot = hv & EA_USER_HASH_MAX; 
    340340 
     
    532532    if (eaccelerator_mm_instance != NULL && (where == eaccelerator_shm_and_disk ||  
    533533                where == eaccelerator_shm || where == eaccelerator_shm_only)) { 
    534         hv = hash_mm(xkey, xlen); 
     534        hv = zend_get_hash_value(xkey, xlen); 
    535535        slot = hv & EA_USER_HASH_MAX; 
    536536 
  • eaccelerator/trunk/eaccelerator.c

    r252 r253  
    121121/******************************************************************************/ 
    122122 
    123 inline unsigned int hash_mm(const char *data, int len) { 
    124   unsigned int h; 
    125   const char *e = data + len; 
    126   for (h = 2166136261U; data < e; ) { 
    127     h *= 16777619; 
    128     h ^= *data++; 
    129   } 
    130   return h; 
    131 } 
    132  
    133123/* Find a script entry with the given hash key */ 
    134124static mm_cache_entry* hash_find_mm(const char  *key, 
     
    142132  hv = buf->st_dev + buf->st_ino; 
    143133#else 
    144   hv = hash_mm(key, strlen(key)); 
     134  hv = zend_get_hash_value(key, strlen(key)); 
    145135#endif 
    146136  slot = hv & EA_HASH_MAX; 
     
    209199  slot = (x->st_dev + x->st_ino) & EA_HASH_MAX; 
    210200#else 
    211   x->hv = hash_mm(x->realfilename, strlen(x->realfilename)); 
     201  x->hv = zend_get_hash_value(x->realfilename, strlen(x->realfilename)); 
    212202  slot = x->hv & EA_HASH_MAX; 
    213203#endif 
  • eaccelerator/trunk/eaccelerator.h

    r249 r253  
    400400 
    401401unsigned int eaccelerator_crc32 (const char *p, size_t n); 
    402 int eaccelerator_md5 (char *s, const char *prefix, const char *key TSRMLS_DC); 
    403  
    404 unsigned int hash_mm(const char *data, int len);  
     402int eaccelerator_md5 (char *s, const char *prefix, const char *key TSRMLS_DC);  
    405403 
    406404#  ifdef WITH_EACCELERATOR_OPTIMIZER