Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the overhead cost associated with IoC containers like StructureMap?

After attending a recent Alt.NET group on IoC, I got to thinking about the tools available and how they might work. StructureMap in particular uses both attributes and bootstrapper concepts to map requests for IThing to ConcreteThing. Attributes automatically throw up flags for me that either reflection or IL injection is going on. Does anyone know exactly how this works (for StructureMap or other IoC tools) and what the associated overhead might be either at run-time or compile-time?

like image 473
JC Grubbs Avatar asked Dec 29 '25 05:12

JC Grubbs


2 Answers

I can't say much for other IoC toolkits but I use Spring.Net and have found that there is a one off initial performance penalty at startup. Once the container has been configured the application runs unaffected.

like image 93
tgeros Avatar answered Dec 30 '25 19:12

tgeros


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

Another thing to be aware of is that when navigating code you wont be able to go to the code that will be executing at runtime.

like image 31
Darren Avatar answered Dec 30 '25 18:12

Darren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!