IoC容器涉及什么性能开销? [英] What performance overhead do IoC containers involve?

查看:116
本文介绍了IoC容器涉及什么性能开销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

松散耦合当然是很棒的,但是我经常想知道使用IoC容器(例如Castle Windsor)动态使用什么架空线路连接在一起?

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 coupled system?

我知道一个详细的答案将取决于IoC的用途,但我真的只是想了解IoC工作涉及的努力程度。

I know that a detailed answer would depend on what the IoC was being used for, but I'm really just trying to get a feel for the magnitude of effort involved in the IoC work.

有没有人有任何统计资料或其他资源?

Does anyone have any stats or other resources regarding this?

谢谢

推荐答案

有关于性能的链接

http:/ /realfiction.net/?q=node/143

有一个结果

There is links about performance
http://realfiction.net/?q=node/143
There is a results


  • 正常施工:0.0001 / 0.0002

  • 活化剂施工:0.0069 / 0.0071

  • 集装箱建筑(Castle Windsor):0.1014 / 0.1068

  • 容器构造(Spring.NET):0.069 / 0.0722

但是你可以看到温莎不是最快的IoC (Autofac更快)

But as you can see the Windsor isnt the fastest IoC (Autofac much faster)

正确的答案是,性能无关紧要:)。

因为正确使用IoC,所有注册过程都处于初始化阶段。

换句话说,使用IoC必须减少您的否则实时。

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.

这篇关于IoC容器涉及什么性能开销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆