-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Implement INIT_FCALL IS_PTR specialization #13518
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
e79074b
to
5333637
Compare
5333637
to
b8c3910
Compare
I also added support for user functions just now, it wasn't very hard. After this, the optimizer may switch to Methods may be a bit more tricky, since they may be loaded out of shm, and then persisted again with inheritance cache. The pointers will need to be corrected in both cases. |
I did some more benchmarking, and the user function spec does not seem profitable. That's likely because we need to check whether the runtime cache is initialized. Details
I think we may have more luck with methods, because they perform a polymorphic cache slot check, along with a staticness check. Both of these can be avoided, while we still need a runtime cache init check for the callee. |
bbae5f4
to
4cfed6b
Compare
4cfed6b
to
b90b37c
Compare
@dstogov Ok, please have a look at this alternative implementation. It adjusts zend_vm_gen.php so that some specialized handlers are used even without opcache. I'm not sure if this approach is better. What it did make trivial is adding another specialized handler for internal calls that drops Also, I benchmarked this for method calls, but unfortunately they weren't really profitable. |
I'm not sure if it makes sense to implement this idea for internal functions only. |
Ok. So do you think the approach with zend_vm_gen.php is ok? I didn't benchmark without opcache, I can do that to make sure there's no regression. I would expect almost all checks to be elided. |
I don't see problems with zend_vm_gen.php modification.
I wouldn't care about +/-1% difference without opcache. |
Do you have a suggestion on how to improve this? I kept the name generic in case this is ever used for something else (e.g. class pointers). I can make the name more specific too if it helps with clarity. |
Results w/o opcache: ≈ +0.6%. That seems acceptable. Details
|
In case of internal functions only, we don't need these arrays at all. |
As I already said, I'm not sure if this INIT_FCALL optimization makes sense for internal functions only. We already thought about similar optimization long time ago, but decided that it doesn't cost the complication and fragmentation. ~0.8% percent improvement on real life apps with internal functions only looked promising, but as you discovered this idea doesn't work for user functions and methods. |
Closed in favor of #13634. |
Alternative to GH-13445.
@dstogov Let me know if you prefer this approach.