-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[RFC] Autoload Classmap #6776
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
[RFC] Autoload Classmap #6776
Conversation
…her than calling out to a userland function
There is some performance with this RFC ? |
Testing performance in 8.0 is disappointingly minimal, a few percentage points at most vs calling a userland function that checks its own classmap. |
Thank you. |
Do you expect this could get faster? If not, what do you think would be the motivation for this change? |
This is a minor optimization. A few percent on one of the most commonly performed actions completely transparent to the user (subject to uptake by major frameworks such as composer) is still a gain, the change in php-src is minimal. |
Hi, i've don't have any experience on this kind of situation, and don't known if i'm allow to comment on this or not. Feel free, to delete my comment or ignore me. I have one question, related to this (maybe), but what if "autoload" was in fact native on PHP without using "autoload" and "require_once" magic. What i'm trying to said, i love to see if we could use really native "imports" like Sorry if this is a dumb question or if isn't right place. |
@gravataLonga Hi. Generally, all discussion are on the mailing list. Please send all replies there. Regarding your question, autoload is already native in PHP since version 5.0. I am not sure what you really meant. All classes can be loaded by just using them in code. No special includes are necessary. It's rare that you can eradicate |
@kamil-tekiela sorry you can ignore me. Just following reply, i mean about // ./vendor/composer/ClassLoader.php
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
} There aren't a native |
@markrandall Would you like to pursue this RFC? |
Not for the time being, I abandoned it when Girgias started his wider re-write of the autoloading system to handle functions etc. |
Adds a mechanism to autoload classes based on a static list rather than invoking a userland function.
The classmap is considered authoritative when a key is present. The file must exist, and it must result in the class being loaded.