Loose coupling is wonderful of course, but I have often wondered what overhead wiring up dynamically using an IoC container (for example Castle Windsor) has over a tightly coupl
The best way to understand how complex an IoC container is comes from analyzing it.
In a particular experience, once I took an entire afternoon debugging some simple 'Hello World' code using plexus, which Maven is based upon (and here is a helpful link to browse its source code). It kinda came up (by looking at defaultPlexusContainer) as:
This leaves an important aspect, deep into the steps above: Looking up a component. In plexus, the Phase concept wraps the steps for the construction of an Object, and those Phases are usually bound to a Personality concept. However, for the default setting, this is done by executing the following phases:
Most of those steps are optional, and usually involve identifying a given interface and calling it on the target object - this is the default for the plexus personality, note that.
Also, each object might be bound to a lifecycle manager, which mostly makes the difference between a new object and a singleton.
In my particular record: The most difficult part is actually parsing the configuration, and booting the container. After that, you're likely to notice no further difference in performance.
There is links about performance
http://realfiction.net/?q=node/143
There is a results
But as you can see the Windsor isnt the fastest IoC (Autofac much faster)
The correct answer is, the performance doesn't matter :).
Because the correct using of IoC ,when all registering process is at initializing stage.
In other words the using of IoC must reducing the count of your "if else" in real-time.
You'll have slower initialization times, as everything is loaded when the container is started. If init time doesn't matter to you, everyone's a winner on that chuck-a-luck wheel.