From d21e20054b97e758c3d052e28dd7a83ecaaaebf3 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 29 Oct 2017 15:59:50 +0100 Subject: [PATCH] Remove outdated performance tips --- performance.rst | 81 +------------------------------------------------ 1 file changed, 1 insertion(+), 80 deletions(-) diff --git a/performance.rst b/performance.rst index 5b4b01eb48d..82ca370e33d 100644 --- a/performance.rst +++ b/performance.rst @@ -96,8 +96,7 @@ value too using the ``realpath_cache_ttl`` option: Use Composer's Class Map Functionality -------------------------------------- -By default, the Symfony Standard Edition uses Composer's autoloader -in the `autoload.php`_ file. This autoloader is easy to use, as it will +Symfony uses Composer's autoloader. This autoloader is easy to use, as it will automatically find any new classes that you've placed in the registered directories. @@ -125,82 +124,6 @@ your deploy process: Prevents Composer from scanning the file system for classes that are not found in the class map. -Caching the Autoloader with APC -------------------------------- - -Another solution is to cache the location of each class after it's located -the first time. Symfony comes with a class - :class:`Symfony\\Component\\ClassLoader\\ApcClassLoader` - -that does exactly this. To use it, just adapt your front controller file. -If you're using the Standard Distribution, make the following changes:: - - // app.php - // ... - - use Symfony\Component\ClassLoader\ApcClassLoader; - - // do not use $loader as a variable name here as it would - // be overwritten when loading the bootstrap.php.cache file - $classLoader = require __DIR__.'/../app/autoload.php'; - include_once __DIR__.'/../app/bootstrap.php.cache'; - - // Use APC for autoloading to improve performance - // Change 'sf2' by the prefix you want in order - // to prevent key conflict with another application - $loader = new ApcClassLoader('sf2', $classLoader); - $loader->register(true); - - // ... - -For more details, see :doc:`/components/class_loader/cache_class_loader`. - -.. note:: - - When using the APC autoloader, if you add new classes, they will be found - automatically and everything will work the same as before (i.e. no - reason to "clear" the cache). However, if you change the location of a - particular namespace or prefix, you'll need to flush your APC cache. Otherwise, - the autoloader will still be looking at the old location for all classes - inside that namespace. - -.. index:: - single: Performance; Bootstrap files - -Use Bootstrap Files -------------------- - -To ensure optimal flexibility and code reuse, Symfony applications leverage -a variety of classes and 3rd party components. But loading all of these classes -from separate files on each request can result in some overhead. To reduce -this overhead, the Symfony Standard Edition provides a script to generate -a so-called `bootstrap file`_, consisting of multiple classes definitions -in a single file. By including this file (which contains a copy of many of -the core classes), Symfony no longer needs to include any of the source files -containing those classes. This will reduce disc IO quite a bit. - -If you're using the Symfony Standard Edition, then you're probably already -using the bootstrap file. To be sure, open your front controller (usually -``app.php``) and check to make sure that the following line exists:: - - include_once __DIR__.'/../var/bootstrap.php.cache'; - -Note that there are two disadvantages when using a bootstrap file: - -* the file needs to be regenerated whenever any of the original sources change - (i.e. when you update the Symfony source or vendor libraries); - -* when debugging, one will need to place break points inside the bootstrap file. - -If you're using the Symfony Standard Edition, the bootstrap file is automatically -rebuilt after updating the vendor libraries via the ``composer install`` command. - -Bootstrap Files and Byte Code Caches -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Even when using a byte code cache, performance will improve when using a bootstrap -file since there will be fewer files to monitor for changes. Of course, if this -feature is disabled in the byte code cache (e.g. ``apc.stat=0`` in APC), there -is no longer a reason to use a bootstrap file. - Learn more ---------- @@ -213,5 +136,3 @@ Learn more .. _`APC`: http://php.net/manual/en/book.apc.php .. _`APCu Polyfill component`: https://github.com/symfony/polyfill-apcu .. _`APCu PHP functions`: http://php.net/manual/en/ref.apcu.php -.. _`autoload.php`: https://github.com/symfony/symfony-standard/blob/master/app/autoload.php -.. _`bootstrap file`: https://github.com/sensiolabs/SensioDistributionBundle/blob/master/Composer/ScriptHandler.php pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy