What is the overhead associated with IoC containers such as StructureMap?

After visiting the recent Alt.NET group on IoC, I thought about the tools available and how they might work. StructureMapin particular, it uses both attributes and bootstrapping concepts to match queries for IThing- ConcreteThing. Attributes automatically change flags for me, that either reflection or IL injection occurs. Does anyone know how this works (for StructureMapor other IoC tools) and what related overhead can be either at runtime or at compile time?

+3
source share
4 answers

I can't say much for other IoC toolkits, but I use Spring.Net and find that there is one initial performance hit at startup. After configuring the container, the application starts without changes.

+1
source

I use Windsor from CastleProject and found it extremely useful for reducing dependencies. I haven't noticed a performance issue yet, but one thing I find is that the configuration can get a little cumbersome. To help in this regard, I'm starting to look at Binsor, which is the DSL for Windsor written in boo.

Another thing to keep in mind is that when navigating through the code, you will not be able to jump to the code that will be executed at runtime.

+1

, . , IoC. - . . IoC, .

0

IOC, :

http://blogs.microsoft.co.il/blogs/shay/archive/2008/09/30/building-custom-object-mapper.aspx

, , , , , .

I do not process instance types (singleton, transient, thread, pool ...), all objects will be created as single, you name it:

IRepository _repository = ObjectFactory.BuildFactory<IRepository>();

Shay

0
source

Source: https://habr.com/ru/post/1696829/


All Articles