-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fast Class Cache #6843
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
Fast Class Cache #6843
Conversation
This is generalization of idea, that was previously usesd for caching resolution of class_entries in zend_type. Now very similar mechanizm is used for general zend_string into zend_class_entry resolution.
@nikic could you please take a look The PR breaks one test ext/reflection/tests/union_types.phpt. The behavior of this test is different (different class name case) with and without opcache. It's possible to restore the original behavior restoring zend_type.ce_cache__ptr, but this looks wring for me. Actually, the test reflects very weird implementation behavior. What do you think? May be it's time to propose case-sensitive names? |
…avior. This breaks 3 tests with opcache enabled: Zend/tests/return_types/inheritance001.phpt Zend/tests/return_types/inheritance002.phpt Zend/tests/return_types/inheritance003.phpt
@nikic I fixed ext/reflection/tests/union_types.phpt and changed other 3 test files, where class name case-sensitivity doesn't make sense. |
I imagine for #6799 I'll need to update it in a similar manner as how it's done in this PR? |
yes. It shouldn't be difficult. |
Merged into master as d8e4fba |
Do you think it would make sense to allocate the map ptr offset for property type class names even without opcache, and then get rid of the ZEND_TYPE_HAS_CE variant entirely? We now have three different ways to store resolved class names, in runtime cache (for argument types), in string map ptr cache (with opcache) and in zend_type (without opcache, for typed properties). |
By the way, I think this change is a really great idea. It's an elegant solution to string class name lookup cost in class_exists, reflection etc. |
I think, this is possible. Without opcache we manage per-process/thread interned strings . We may also manage per-process/thread map_ptr. |
This is generalization of idea, that was previously usesd for caching
resolution of class_entries in zend_type. Now very similar mechanizm is
used for general zend_string into zend_class_entry resolution.