Comparing performance with other frameworks

Feb 19, 2012 at 11:06 AM
Edited Feb 19, 2012 at 11:11 AM

[This thread is a copy from an old thread that -for some strange reason- was deleted from CodePlex.]

Asked by user apocolpse at Nov 25 2010:

What's the performance of this library like in comparison to other libraries like Ninject or Autofac?

Feb 19, 2012 at 11:10 AM
Edited Feb 25, 2013 at 1:10 PM
The library is extremely fast. I measured it using the performance comparison method given by this site. The results are:
  • Compared to Ninject v2.1, Simple Injector is over a 1500 times as fast when retrieving transient objects, and more than 80 times as fast when resolving singletons.
  • Compared to AutoFac v2.2, Simple Injector is over 430 times as fast when retrieving transient objects, and over 8 times as fast when retrieving singletons.
There are three reasons why Simple Injector is this fast:
  1. It has an expression tree based design, and will in most cases compile a complete object graph down to a single delegate.
  2. The framework's happy path is lock free; after the initialization phase and after delegates for object creation are compiled, no locks will be taken.
  3. There are several performance tweaks, such as tweaks that will minimize the amount of method calls the framework takes in the happy path.
When it comes to picking your IoC framework, there is of course much more in life than performance. However, if performance is your main concern, the Simple Injector is your friend!

This blog post does a performance comparison of 15 different IoC containers for .NET. According to the author, of all containers, Simple Injector is the fastest.

Here you find a more thorough explanation about the performance of the Simple Injector. I hope this answers your question.
Marked as answer by dot_NET_Junkie on 11/3/2013 at 11:47 PM