Reputation: 7535
I'm using Blackfire to profile my PHP / Laravel application. Across most endpoints, Composer seems to be taking a long time. Specifically, the method Composer\Autoload\includeFile
. In the example below, it gets called 240 times.
Now I have run composer dump-autoload --optimize
and I have opcache
enabled. Is this behavior normal or is this indicative of an issue? My understanding would be that the autoloader should only need to be included once.
Upvotes: 1
Views: 1273
Reputation: 25
Try dumping autoload in "authoritative" mode with
composer dump-autoload -a
.
This should yield better performance – I saw about 13% speed improvement on one API endpoint after doing this.
More info: https://getcomposer.org/doc/articles/autoloader-optimization.md
Upvotes: 1
Reputation: 180004
The autoloader's primary purpose is to load all the various classes in your application. As such, it's likely to call includeFile
many times in a single request.
Upvotes: 0