Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DI/IoC Container Performance Benchmark Comparison?

I've found some 2008 benchmark results for testing the performance of several of the top .NET DI/IoC containers here. But I haven't been able to find any updated results. Are there any benchmarks out there that compare some of the big IoC containers (StructureMap, Unity, Ninject, Autofac, Castle Windsor, etc.)?

like image 833
David Hoerster Avatar asked Mar 15 '11 17:03

David Hoerster


People also ask

Which IoC container is best?

You can waste days evaluating IOC containers. The top ones are quite similar. There is not much in this, but the best ones are StructureMap and AutoFac.

What do IoC and Di stand for?

Overview. In this tutorial, we'll introduce the concepts of IoC (Inversion of Control) and DI (Dependency Injection), as well as take a look at how these are implemented in the Spring framework.

Is IoC and di a design pattern?

Dependency Injection (DI) is a design pattern used to implement IoC. It allows the creation of dependent objects outside of a class and provides those objects to a class through different ways.

Should IoC container be static?

There is no requirement that IoC containers have to be static, in fact you can create as many as you wish - it all depends on what you need.


2 Answers

I would not recommend using performance benchmarks to pick an IoC container. There are many, many more important factors, such as feature set, development roadmap and maintainability, etc.

Realize that the benchmark you're citing is, in the worst case, only showing a 3-4x difference in speed over 1 million calls. In a "real world" scenario, DI/IoC is used to wire up dependencies, and will have a very minimal impact on overall application performance, as this construction phase is an incredibly small portion of your overall runtime. Choosing a "high performance" vs. a "low performance" IoC container will likely have no discernible impact on your application's perceived performance.

In the unlikely scenario that performance is truly important to your specific usage case, a benchmark is unlikely to be a valid measure of how the IoC container's performance will impact you, as benchmarks tend to be skewed towards a specific problem set. I would highly recommend doing your own profiling and measurement if you truly believe this is a serious issue.

like image 144
Reed Copsey Avatar answered Oct 18 '22 06:10

Reed Copsey


In my case, speed of IoC container has been an important factor. I've had an application that performs many injections and found that Ninject was slowing the application down considerably. Taking out the IoC completely solved the performance issues. I will be looking into other solutions.

like image 6
Sachin Kainth Avatar answered Oct 18 '22 05:10

Sachin Kainth