【发布时间】:2016-08-31 07:18:30
【问题描述】:
我需要在速度方面优化我的 symfony。托管服务器正在运行 php 7.x.x 并启用了 opcache。 apc_u 扩展已被禁用,但如果真的需要,我可以要求启用它。
我现在正在打电话:
composer dump-autoload --optimize
每当我部署我的应用程序时。这样,应用程序应该已经拥有所有需要的映射,而不必遍历文件夹(对吗?)。我想知道如果autoload_classmap.php 已经得到很好的更新,ApcClassLoader 是否可以提高我的表现。
这是我的app.php 第一行:
use Symfony\Component\HttpFoundation\Request;
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../app/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
简短的问题:如果autoload_classmap.php 已经得到很好的更新,启用ApcClassLoader 可以提高我的表现吗?
【问题讨论】:
标签: php symfony composer-php symfony-2.8