mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix performance degradation introduced in c2547ab7dc
After discussing with someone, our current running theory is that the local variable forces the compiler to reserve an additional register for the whole lifespan of the function. Dropping it and just loading the value should restore the previous code generation. Closes GH-9876
This commit is contained in:
parent
6e87485d3c
commit
86456574bb
1 changed files with 3 additions and 4 deletions
|
@ -658,15 +658,14 @@ ZEND_API void ZEND_FASTCALL zend_hash_iterators_advance(HashTable *ht, HashPosit
|
||||||
/* Hash must be known and precomputed before */
|
/* Hash must be known and precomputed before */
|
||||||
static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, const zend_string *key)
|
static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, const zend_string *key)
|
||||||
{
|
{
|
||||||
zend_ulong key_hash = ZSTR_H(key);
|
|
||||||
uint32_t nIndex;
|
uint32_t nIndex;
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
Bucket *p, *arData;
|
Bucket *p, *arData;
|
||||||
|
|
||||||
ZEND_ASSERT(key_hash != 0 && "Hash must be known");
|
ZEND_ASSERT(ZSTR_H(key) != 0 && "Hash must be known");
|
||||||
|
|
||||||
arData = ht->arData;
|
arData = ht->arData;
|
||||||
nIndex = key_hash | ht->nTableMask;
|
nIndex = ZSTR_H(key) | ht->nTableMask;
|
||||||
idx = HT_HASH_EX(arData, nIndex);
|
idx = HT_HASH_EX(arData, nIndex);
|
||||||
|
|
||||||
if (UNEXPECTED(idx == HT_INVALID_IDX)) {
|
if (UNEXPECTED(idx == HT_INVALID_IDX)) {
|
||||||
|
@ -678,7 +677,7 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, con
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (p->h == key_hash &&
|
if (p->h == ZSTR_H(key) &&
|
||||||
EXPECTED(p->key) &&
|
EXPECTED(p->key) &&
|
||||||
zend_string_equal_content(p->key, key)) {
|
zend_string_equal_content(p->key, key)) {
|
||||||
return p;
|
return p;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue