-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Refactor some ext/pcre code for performance #12447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The call overhead of this function is quite large.
This is allocated together with the match data and stays loop invariant: the pointer is always the same (the values not however).
The lookup is loop invariant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
zval tmp; | ||
ZVAL_NULL(&tmp); | ||
zend_hash_next_index_insert_new(match_sets[i], &tmp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really should add zend_hash APIs to deal with those cases.
We have add_index_*()
and add_assoc_*()
when the array is wrapped in a zval but nothing when working with a HashTable directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, but it's worth checking first if this occurs often before adding more public APIs. I don't know off the top of my head how common this is.
In any case, I'm not gonna deal with it in this PR :p
Gives about a 1.1-1.2% performance win on Symfony demo.
Spit over various commits with short reasoning. Once merged, can be squashed into one with the commit descriptions and titles in a single commit.