According to New Relic transaction tracer, sometimes Composer\Autoload\includeFile
takes around 318 ms to load my project.
I have dumped a classmap from composer, but still no difference it made.
composer.json
requires the following:
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.4.*",
"zendframework/zendservice-amazon": "2.*",
"wisembly/elephant.io": "~3.0",
"knplabs/github-api": "~1.2"
}
I only have one module in my ZF2 application.
How can my ZF2 autoloading perform faster?
We had the exact same issue while debugging in New Relic. Finally, we traced it to the filesystem, it turned out we weren't using opcode cache, which can be painful under high load.
Check your opcode caching and try to tweak it's memory settings. That's how we managed to solve it.
Note that "optimizing" the autoloading is not necessarily resulting in the best load times in every case. It's a race between getting faster by eliminating file system access versus getting slower by loading more unused stuff into memory.
Why use a PSR-0 or PSR-4 autoload in composer if classmap is actually faster?
来源:https://stackoverflow.com/questions/31103521/zend-framework-2-composer-autoload-includefile-is-slow