Hi,
last week I have noticed that my local dev env wasn’t running optimal in terms of class loading. Blackfire reported that Composer has to “find” hundreds of class files during each Nextcloud process.
As far as I understand that happened because Nextcloud registers a PSR-4 and a PSR-0 autoloader for all apps unless they have a special composer/autoloader.php
file. Optimizing app autoloaders with class maps, even if authoritative, had no influence on this. My theory is that the Nextcloud server autoloader is always queried first for classes and it does succeed for load files, despite the slow performance. So it overshadowed the app class loaders.
It is possible trick the system into stopping the generic auto loaders for apps. The details can be found at https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/classloader.html#app-custom-classloader.
On my local environment the improvements were not measurable but we assume that distributed production setups with remote/shared storage for PHP scripts can benefit from this optimization.
Cheers,