DI/IoC容器性能基准比较? [英] DI/IoC Container Performance Benchmark Comparison?

查看:98
本文介绍了DI/IoC容器性能基准比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现一些2008年基准测试结果可以测试几个顶级.NET DI/IoC容器的性能

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.)?

推荐答案

我不建议使用性能基准来选择IoC容器.功能集,开发路线图和可维护性等许多重要因素都很多.

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.

请注意,在最坏的情况下,您所引用的基准仅显示超过100万次通话的3-4倍速度差异.在现实世界"场景中,DI/IoC用于连接依赖项,并且对整个应用程序性能的影响很小,因为此构建阶段仅占整个运行时的一小部分.选择高性能"与低性能"的IoC容器可能不会对应用程序的感知性能产生明显的影响.

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.

在不太可能出现性能对您的特定使用情况非常重要的情况下,基准不太可能有效衡量IoC容器的性能将如何影响您,因为基准倾向于偏向特定的问题集.如果您真的相信这是一个严重的问题,我强烈建议您自行进行分析和测量.

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.

这篇关于DI/IoC容器性能基准比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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