Context
While step-by-step increasing the use of PHP-DI in a monolithic application, the amount of PHP-DI Definitions also increased. As a result: enabling container compilation involved an increasingly bigger compiled container. In this case the compiled container is a .php file:
with ~38k lines of code
which contains a const METHOD_MAPPING array with ~3.5k entries and the same amount of protected function statements
with a filesize of ~1.9MB
which uses ~3.9MB of memory according to OpCache
Observation
I noticed that this increased size of the compiled container has a negative effect on the performance. "Probably" because on each request the compiled container has to be loaded completely, while only a small part of it is actually used: a nature of a monolithic application: a lot is possible, but a single request only invokes a part of the functionality.
Suggestion
It might be good to add a kind of "disclaimer" to the documentation, that it might be good to check whether container compilation actually contributes to better performance and there might be a certain "size" of use of PHP-DI when compiling the container would not be recommended...
Context While step-by-step increasing the use of PHP-DI in a monolithic application, the amount of PHP-DI Definitions also increased. As a result: enabling container compilation involved an increasingly bigger compiled container. In this case the compiled container is a .php file:
const METHOD_MAPPING
array with ~3.5k entries and the same amount ofprotected function
statementsObservation I noticed that this increased size of the compiled container has a negative effect on the performance. "Probably" because on each request the compiled container has to be loaded completely, while only a small part of it is actually used: a nature of a monolithic application: a lot is possible, but a single request only invokes a part of the functionality.
Suggestion It might be good to add a kind of "disclaimer" to the documentation, that it might be good to check whether container compilation actually contributes to better performance and there might be a certain "size" of use of PHP-DI when compiling the container would not be recommended...
Used system: