Changeset 506 for trunk/utils.c


Ignore:
Timestamp:
2008-01-05T05:45:48+01:00 (7 years ago)
Author:
moo
Message:

optimized function_table/class_table by caching hash value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils.c

    r504 r506  
    425425 
    426426#ifdef HAVE_XCACHE_CONSTANT 
    427 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 
     427void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 
    428428{ 
    429429    if (zend_u_hash_add(EG(zend_constants), type, key, len, 
     
    445445/* }}} */ 
    446446#endif 
    447 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 
     447void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 
    448448{ 
    449449    zend_bool istmpkey; 
     
    475475} 
    476476/* }}} */ 
    477 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 
     477ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 
    478478{ 
    479479    zend_bool istmpkey; 
     
    487487#endif 
    488488    if (istmpkey) { 
    489         zend_u_hash_update(CG(class_table), type, key, len, 
     489        zend_u_hash_quick_update(CG(class_table), type, key, len, h, 
    490490                    cest, sizeof(xc_cest_t), 
    491491                    ZESW(&stored_ce_ptr, NULL) 
     
    495495        } 
    496496    } 
    497     else if (zend_u_hash_add(CG(class_table), type, key, len, 
     497    else if (zend_u_hash_quick_add(CG(class_table), type, key, len, h, 
    498498                cest, sizeof(xc_cest_t), 
    499499                ZESW(&stored_ce_ptr, NULL) 
     
    685685        zend_constant *c = (zend_constant*) b->pData; 
    686686        xc_install_constant(sandbox->filename, c, 
    687                 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC); 
     687                BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 
    688688        b = b->pListNext; 
    689689    } 
     
    695695        zend_function *func = (zend_function*) b->pData; 
    696696        xc_install_function(sandbox->filename, func, 
    697                 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC); 
     697                BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 
    698698        b = b->pListNext; 
    699699    } 
     
    703703    while (b != NULL) { 
    704704        xc_install_class(sandbox->filename, (xc_cest_t*) b->pData, -1, 
    705                 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC); 
     705                BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 
    706706        b = b->pListNext; 
    707707    } 
Note: See TracChangeset for help on using the changeset viewer.