Performance impact of creating sub containers in Unity 2.0
How costly (performance impact) is creating subcontainers in Unity 2.0? The scenario is for example web application or web service where main container is initialized on start of the application but each processed request has i开发者_高级运维ts own instace of subcontainer created from the main one. The configuration of the container will not change. The reason is usage of HierarchicalLifetimeManager
.
As always when the question is related to performance the answer is: measure your application to understand the performance implications for your specific application.
As a general observation, for mainstream applications that integrate with out-of-process resources (such as databases, web services, etc.), object composition is rarely a performance bottleneck. Compose your object graphs with confidence - odds are that the DI Container will not give you a measurable overhead.
精彩评论