Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Closed
wants to merge 3 commits into from
Closed

Fast Class Cache #6843

wants to merge 3 commits into from

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Apr 8, 2021

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.

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.
@dstogov
Copy link
Member Author

dstogov commented Apr 8, 2021

@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?

dstogov added 2 commits April 8, 2021 16:52
…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
@dstogov
Copy link
Member Author

dstogov commented Apr 8, 2021

@nikic I fixed ext/reflection/tests/union_types.phpt and changed other 3 test files, where class name case-sensitivity doesn't make sense.

@Girgias
Copy link
Member

Girgias commented Apr 8, 2021

I imagine for #6799 I'll need to update it in a similar manner as how it's done in this PR?

@dstogov
Copy link
Member Author

dstogov commented Apr 8, 2021

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.

@dstogov
Copy link
Member Author

dstogov commented Apr 8, 2021

Merged into master as d8e4fba

@dstogov dstogov closed this Apr 8, 2021
@nikic
Copy link
Member

nikic commented Apr 8, 2021

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).

@nikic
Copy link
Member

nikic commented Apr 8, 2021

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.

@dstogov
Copy link
Member Author

dstogov commented Apr 8, 2021

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?

I think, this is possible. Without opcache we manage per-process/thread interned strings . We may also manage per-process/thread map_ptr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.