PHP-DI / PHP-DI

The dependency injection container for humans
https://php-di.org
MIT License
2.68k stars 320 forks source link

[Documentation] Document limitations of using the CompiledContainer #615

Open holtkamp opened 6 years ago

holtkamp commented 6 years ago

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:

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...

Used system:

mnapoli commented 6 years ago

:+1:

It might be also interesting to checkout how Symfony handles those situations, maybe they split the dumped container across several files 🤔