-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Separate internal and user function extension handles #14252
Separate internal and user function extension handles #14252
Conversation
Actually, I'm just seeing that |
111e8dc
to
25d1b6e
Compare
This allows us to skip zend_init_internal_run_time_cache() when opcache is enabled. This function can be quite expensive.
25d1b6e
to
95e0c97
Compare
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.
I think it's OK.
@bwoebi why you don't use indirect map_ptrs?
they should be already used for internal classes.
I noticed this function profiling Symfony Demo.
It took ~2% with disabled observer and enabled JIT.
@dstogov I think the downside is that then we have to do the run time check for internal functions too, as well as allocate more arena space. This might still be faster overall, I don't know. We'd have to try. |
@dstogov I started working on your idea in master...iluuu1994:php-src:alloc-internal-rtc-at-runtime. I'm very skeptical it will be faster than this solution, because (compared to this one) it only avoids a Anyway, I haven't measured this yet. I will do so tomorrow. |
c5b1c4c
to
563c465
Compare
@iluuu1994 The current form of the PR looks pretty reasonable and about zero extra cost to observers for me, so I like it :-) |
563c465
to
95e0c97
Compare
This allows us to skip zend_init_internal_run_time_cache() when opcache is enabled. This function can be quite expensive.
This is backwards in compatible with other extensions that use extension handles for internal functions. If they rely on
zend_get_op_array_extension_handle()
to register cache for internal functions, they might run into segfaults due to NULL pointers, since the cache won't actually be allocated. Even worse, the offset they rely on may clash with that of other, correctly installed internal function handles, and/or overflow the internal function completely, leading to unpredictable behavior. Hence, it might be better to delay this to master.Benchmark
Tested with Symfony Demo. The time win is constant across applications, so the relative time win will look more favorable for shorter requests.