What is the best way to debug performance problems?

前端 未结 8 1433
夕颜
夕颜 2021-02-06 11:51

I\'m writing a plug-in for another program in C#.NET, and am having performance issues where commands take a lot longer then I would. The plug-in reacts to events in the host pr

相关标签:
8条回答
  • 2021-02-06 12:30

    Sounds like you want a code 'profiler'. http://en.wikipedia.org/wiki/Code_profiler#Use_of_profilers

    I'm unfamiliar with which profilers are the best for C#, but I came across this link after a quick google which has a list of free open-source offerings. I'm sure someone else will know which ones are worth considering :)

    http://csharp-source.net/open-source/profilers

    0 讨论(0)
  • 2021-02-06 12:34

    You can also use performance counter for asp.net applications.

    0 讨论(0)
  • 2021-02-06 12:36

    My Profiler List includes ANTS, dotTrace, and AQtime.


    However, looking more closely at your question, it seems to me that you should do some unit testing at the same time you're doing profiling. Maybe start by doing a quick overall performance scan, just to see which areas need most attention. Then start writing some unit tests for those areas. You can then run the profiler while running those unit tests, so that you'll get consistent results.

    0 讨论(0)
  • 2021-02-06 12:39

    Despite the title of this topic I must argue that the "best" way is subjective, we can only suggest possible solutions.

    I have had experience using Redgate ANTS Performance Profiler which will show you where the bottlenecks are in your application. It's definitely worth checking out.

    0 讨论(0)
  • 2021-02-06 12:42

    Visual Studio Team System has a profiler baked in, its far from perfect, but for simple applications you can kind of get it to work.

    Recently I have had the most success with EQATECs free profiler, or rolling my own tiny profiling class where needed.

    Also, there have been quite a few questions about profilers in that past see: http://www.google.com.au/search?hl=en&q=site:stackoverflow.com+.net+profiler&btnG=Google+Search&meta=&aq=f&oq=

    0 讨论(0)
  • 2021-02-06 12:49

    Don't ever forget Rico Mariani's advice on how to carry out a good perf investigation.

    0 讨论(0)
提交回复
热议问题