【问题标题】:composer dump-autoload - command作曲家转储自动加载 - 命令
【发布时间】:2015-04-06 01:42:42
【问题描述】:

看不懂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

如果它是“为性能而转换”,为什么还要转储自动加载器?

我很困惑。

【问题讨论】:

    标签: composer-php


    【解决方案1】:

    它转储自动加载器使用的类映射。这样,自动加载器不需要搜索文件系统来找到正确的文件,它已经知道该文件。这样可以节省时间。

    【讨论】:

      【解决方案2】:

      类图并非在所有情况下都更快。在将其用于生产之前,请小心并衡量您从中获得的收益。

      详情请看我的回答:Why use a PSR-0 or PSR-4 autoload in composer if classmap is actually faster?

      【讨论】:

        猜你喜欢
        • 2018-05-18
        • 2015-12-16
        • 2013-12-16
        • 1970-01-01
        • 2016-10-20
        • 1970-01-01
        • 2014-05-29
        • 1970-01-01
        • 2013-12-09
        相关资源
        最近更新 更多