diff --git a/performance.rst b/performance.rst index 893ba7877ba..28b9f38dfbe 100644 --- a/performance.rst +++ b/performance.rst @@ -12,6 +12,7 @@ Symfony Application Checklist ----------------------------- #. :ref:`Install APCu Polyfill if your server uses APC ` +#. :ref:`Dump the service container into a single file ` Production Server Checklist --------------------------- @@ -33,6 +34,51 @@ OPcache, install the `APCu Polyfill component`_ in your application to enable compatibility with `APCu PHP functions`_ and unlock support for advanced Symfony features, such as the APCu Cache adapter. +.. _performance-service-container-single-file: + +Dump the Service Container into a Single File +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 4.4 + + The ``container.dumper.inline_factories`` parameter was introduced in + Symfony 4.4. + +Symfony compiles the :doc:`service container ` into multiple +small files by default. Set this parameter to ``true`` to compile the entire +container into a single file, which could improve performance when using +"class preloading" in PHP 7.4 or newer versions: + +.. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + parameters: + # ... + container.dumper.inline_factories: true + + .. code-block:: xml + + + + + + + + true + + + + .. code-block:: php + + // config/services.php + + // ... + $container->setParameter('container.dumper.inline_factories', true); + .. _performance-use-opcache: Use the OPcache Byte Code Cache