Skip to content

ext/standard: Optimize symbol table lookup by using zend_hash_lookup#21537

Open
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:zend_hash_lookup
Open

ext/standard: Optimize symbol table lookup by using zend_hash_lookup#21537
arshidkv12 wants to merge 1 commit intophp:masterfrom
arshidkv12:zend_hash_lookup

Conversation

@arshidkv12
Copy link
Contributor

Replaced zend_hash_find() with zend_hash_lookup().
Functionality remains unchanged.

ZVAL_MAKE_REF_EX(entry, 2);
}
if ((orig_var = zend_hash_find(symbol_table, final_name)) != NULL) {
if ((orig_var = zend_hash_lookup(symbol_table, final_name)) != NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not fully equivalent. zend_hash_lookup() will never return NULL when the element wasn't found, but a new null-initialized zval to be populated. So the branch should be removed. The rest looks functionally identical, but you'll also need to verify it's actually better/faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I'll verify the behavior and performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants