Skip to content

Commit 5c34460

Browse files
committed
minor #12819 [Performance] Document the container.dumper.inline_factories parameter (javiereguiluz)
This PR was squashed before being merged into the 4.4 branch (closes #12819). Discussion ---------- [Performance] Document the container.dumper.inline_factories parameter Fixes #12070. Commits ------- 9268f63 [Performance] Document the container.dumper.inline_factories parameter
2 parents 673711d + 9268f63 commit 5c34460

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

performance.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Symfony Application Checklist
1212
-----------------------------
1313

1414
#. :ref:`Install APCu Polyfill if your server uses APC <performance-install-apcu-polyfill>`
15+
#. :ref:`Dump the service container into a single file <performance-service-container-single-file>`
1516

1617
Production Server Checklist
1718
---------------------------
@@ -33,6 +34,51 @@ OPcache, install the `APCu Polyfill component`_ in your application to enable
3334
compatibility with `APCu PHP functions`_ and unlock support for advanced Symfony
3435
features, such as the APCu Cache adapter.
3536

37+
.. _performance-service-container-single-file:
38+
39+
Dump the Service Container into a Single File
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
.. versionadded:: 4.4
43+
44+
The ``container.dumper.inline_factories`` parameter was introduced in
45+
Symfony 4.4.
46+
47+
Symfony compiles the :doc:`service container </service_container>` into multiple
48+
small files by default. Set this parameter to ``true`` to compile the entire
49+
container into a single file, which could improve performance when using
50+
"class preloading" in PHP 7.4 or newer versions:
51+
52+
.. configuration-block::
53+
54+
.. code-block:: yaml
55+
56+
# config/services.yaml
57+
parameters:
58+
# ...
59+
container.dumper.inline_factories: true
60+
61+
.. code-block:: xml
62+
63+
<!-- config/services.xml -->
64+
<?xml version="1.0" encoding="UTF-8" ?>
65+
<container xmlns="http://symfony.com/schema/dic/services"
66+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
68+
69+
<parameters>
70+
<!-- ... -->
71+
<parameter key="container.dumper.inline_factories">true</parameter>
72+
</parameters>
73+
</container>
74+
75+
.. code-block:: php
76+
77+
// config/services.php
78+
79+
// ...
80+
$container->setParameter('container.dumper.inline_factories', true);
81+
3682
.. _performance-use-opcache:
3783

3884
Use the OPcache Byte Code Cache

0 commit comments

Comments
 (0)