当前位置: 动力学知识库 > 问答 > 编程问答 >

Symfony2 : Does Dependency Injection List size have an impact on performances ?

问题描述:

I am simply wondering if the size of the dependency injection list size might become a problem or decrease performances.

A simple case is : Is it better to have a X services or a factory that can make X new $class ?

Thanks.

网友答案:

Having a lot of services is not a bad thing at all, because they are not built until they are actualy needed. Services never used are never built.

Services are to encourage anytime possible, because while they do not impact your app's performances, they enable your code to be split in small blocks more easily maintained and tested.

Don't hesitate to check out the doc for more details.

分享给朋友:
您可能感兴趣的文章:
随机阅读: