我不理解composer dump-autoload
命令的描述:
If you need to update the autoloader because of new classes in a classmap package for example, you can use "dump-autoload" to do that without having to go through an install or update.
Additionally, it can dump an optimized autoloader that converts PSR-0/4 packages into classmap ones for performance reasons. In large applications with many classes, the autoloader can take up a substantial portion of every request's time. Using classmaps for everything is less convenient in development, but using this option you can still use PSR-0/4 for convenience and classmaps for performance.
为什么上面写的是dump ... for performance reasons
?为什么要转储优化的加载器?是“出于性能原因而转储”还是“出于性能原因而转换”?
如果它是“为了性能而转储”,那么为什么它会说classmaps for performance
?
如果是“性能转换”,为什么要丢弃自动加载器呢?
我很困惑。
发布于 2015-02-06 17:37:10
它转储自动加载器使用的类映射。这样,自动加载器就不需要搜索整个文件系统来找到正确的文件,它已经知道该文件了。这将节省时间。
发布于 2015-02-07 05:57:15
Classmap并不是在所有情况下都更快。在将其用于生产之前,要小心并衡量您将从中获得的好处。
详情请看我的答案:Why use a PSR-0 or PSR-4 autoload in composer if classmap is actually faster?
https://stackoverflow.com/questions/28356893
复制相似问题