-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
perf(autoloader): Drop legacy class autoloader #36114
Conversation
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.
👍 cool!
it's still early enough. if we kill this for NC 26 we then need to communicate this as soon as possible on the forum with instructions how to migrate a question also is how difficult it is, whether it's just an hour of work or requires rewriting of things |
It's about renaming php class files. The effort depends on the number of files that need a rename. |
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.
Is it faster because it’s faster or because some classes are not loaded anymore?
How certain are we this is not used in core?
That is an absolutely fair point But CI is quite happy and I believe we migrated all PSR0 files to PSR4 at some point. It was a series of PRs by @nickvergessen and @rullzer. |
I guess there is only one way to find out: 🍿 |
As suggested by Christoph, let's warn with 26 and drop on master after release of v26 that should give everyone enough time to upgrade or fix respectively, including us on core/server if needed. |
|
It's showtime |
/rebase |
The documentation says apps should use PSR-4 to get their classes loaded. The legacy PSR-0 is still in place and has a negative impact on performance. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
78ca277
to
416c824
Compare
Hello! Are you familiar with our documentation process already? Changes that affect administrators should be documented here: While I understand sometimes it's handy to merge fast to get your changes in, it would be great if next time you could try to add the documentation before merging. You can find more information on that here: If all your documentation efforts are done, please remove the label 'documentation' and check the checkbox in your opening note and I'll stop bugging you :) Many thanks in advance and thanks again for your work! |
Documentation is in nextcloud/documentation#10231 |
Summary
The documentation says apps should use PSR-4 to get their classes loaded. The legacy PSR-0 is still in place and has a negative impact on performance.
PSR-0 was deprecated in 2014: https://www.php-fig.org/psr/psr-0/. Our docs also list it as deprecated: https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/psr.html#psr-0-autoloading
This is a hard breaking change for the apps that have not yet been upgraded to PSR-4. Therefore I would suggest to warn about this in the 26 upgrade docs and drop the loader only with Nextcloud 27 or later. @AndyScherzinger @PVince81 your call.
Benchmarks
time for i in `seq 1 100`; do php occ; done
Before
real 0m53,323s
user 0m46,178s
sys 0m6,851s
After
real 0m49,161s
user 0m42,581s
sys 0m6,555s
^ that is 7.8% speedup for a generic Nextcloud process
Checklist