mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
micro optimization
This commit is contained in:
parent
63f5e11d9b
commit
858d545ce6
3 changed files with 8 additions and 5 deletions
|
@ -48,6 +48,11 @@ ZEND_API zend_string *zend_empty_string = NULL;
|
|||
ZEND_API zend_string *zend_one_char_string[256];
|
||||
ZEND_API zend_string **zend_known_strings = NULL;
|
||||
|
||||
ZEND_API zend_ulong ZEND_FASTCALL zend_string_hash_func(zend_string *str)
|
||||
{
|
||||
return ZSTR_H(str) = zend_hash_func(ZSTR_VAL(str), ZSTR_LEN(str));
|
||||
}
|
||||
|
||||
ZEND_API zend_ulong ZEND_FASTCALL zend_hash_func(const char *str, size_t len)
|
||||
{
|
||||
return zend_inline_hash_func(str, len);
|
||||
|
|
|
@ -32,6 +32,7 @@ typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const cha
|
|||
ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string;
|
||||
ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned;
|
||||
|
||||
ZEND_API zend_ulong ZEND_FASTCALL zend_string_hash_func(zend_string *str);
|
||||
ZEND_API zend_ulong ZEND_FASTCALL zend_hash_func(const char *str, size_t len);
|
||||
ZEND_API zend_string* ZEND_FASTCALL zend_interned_string_find_permanent(zend_string *str);
|
||||
|
||||
|
@ -97,10 +98,7 @@ END_EXTERN_C()
|
|||
|
||||
static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
|
||||
{
|
||||
if (!ZSTR_H(s)) {
|
||||
ZSTR_H(s) = zend_hash_func(ZSTR_VAL(s), ZSTR_LEN(s));
|
||||
}
|
||||
return ZSTR_H(s);
|
||||
return ZSTR_H(s) ? ZSTR_H(s) : zend_string_hash_func(s);
|
||||
}
|
||||
|
||||
static zend_always_inline void zend_string_forget_hash_val(zend_string *s)
|
||||
|
|
|
@ -99,7 +99,7 @@ static uint32_t add_static_slot(HashTable *hash,
|
|||
Z_STRVAL_P(prop_name),
|
||||
Z_STRLEN_P(prop_name) + 1);
|
||||
|
||||
ZSTR_H(key) = zend_hash_func(ZSTR_VAL(key), ZSTR_LEN(key));
|
||||
ZSTR_H(key) = zend_string_hash_func(key);
|
||||
ZSTR_H(key) += kind;
|
||||
|
||||
pos = zend_hash_find(hash, key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue