如何衡量.NET应用程序的性能 [英] How to measure performance of .Net applications
问题描述
我希望这个问题,我们可以组装一帮很好的建议来衡量的.Net应用程序的性能。
I hope with this question that we can assemble a bunch of good advices to measure performance of .Net applications.
就个人而言,我在一个情况下,我想测试的算法,我想,以确保测量结果是合理的precise。因此,我做到以下几点:
Personally, I'm in a situation where I want to test an algorithm, and I want to be sure the measurements are reasonable precise. Therefore I do the following:
- 在释放模式编译(优化等)
- 在运行Visual Studio以外的应用程序(避免了不必要的检查等。)
- 循环在code多次,并采取最低时间(确保它是JIT编译之前,避免了周期性的GC,OS具体的东西等)的(* 1) 李>
- 使用适当的时钟(* 2)
- Release mode compiling (optimizations etc.)
- Running the application outside Visual studio (avoids unnecessary checks etc.)
- Looping over the code multiple times and take lowest time (makes sure it is JIT-compiled before and avoids periodic GC, OS specific stuff etc.) (*1)
- Using a proper clock (*2)
(* 1)如果输入的是并不总是相同的,它可能是有意义的做一个平均的运行时间。此外,请参阅<一href="http://stackoverflow.com/questions/3785556/accurately-measure-elapsed-wall-clock-time-in-net">Accurately测量经过挂钟时间在.NET
(*1) If the input isn't always the same, it may make sense to do an average of the running time. Also, see Accurately measure elapsed wall clock time in .NET
所以,真正的问题是:
有什么我(或其他人)已经错过了在上面的列表中?而且阐述为什么建议(在列表或新的)作品将AP preciated。
Is there anything I (or others) have missed in the above list? And elaborating of why the recommendations (in the list or new ones) works will be appreciated.
更新:的是使用人 NGEN
基准测试过吗?如果是,为什么?
Update: Is anyone using ngen
before benchmarking? If yes, why?
谢谢,拉塞Espeholt
Thanks, Lasse Espeholt
推荐答案
这些链接可以帮助..
These links may help..
这篇关于如何衡量.NET应用程序的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!