views:

155

answers:

3

What are your opinions about what techniques should I use in the performance analysis and optimization of every application done in .NET technologies?
Also what kind of debugging/tracing techniques do you know that can be powerful?
Do you think that at large scale projects is necessary to have custom debugging/diagnostic classes?
Do you recommend the use of application profilers or any else third party app?

Another concern quite related: How can I obtain the time taken by a method to be executed ?

A: 

Here you have some tips.

How to track IIS server performance

lsalamon
A: 

This is language-agnostic advice. If you get some experience doing performance tuning of existing apps, especially larger ones, you may learn what I have learned. The biggest performance killer is over-design: too many layers of abstraction, notification-driven processing, and such. The problem is that the little things that are supposed to make your life easier, in the abstract, end up sucking you into large cycle-wastage without your knowing it.

Mike Dunlavey
A: 

This is a very generic question:) however here are some guidelines 1- Measure startup time for your app, if startup is a big concern for your customers, consider using Ngen service, using ngen service (ngen.exe) have a considerable performance for Cold startup 2- Workingset and GC heap: what does your gc heap look like; specially your LOH. LOH in CLR is not compacted, so it is important to keep LOH small, or to use caching techniques to reuse objects in LOH ( Large Object Heap holds object that are larger than 85000 bytes ). 3- Throughput : How many operations you can do, what is the response time for your app if it it has a user interface, how many requests it can handle if it is a server app ..etc

Regarding Diagnostics and Tracing, you can use classes in System.Dignostics namespace ,like TraceListner, you can also consider ETW events for your critical code paths (Event Tracing For Windows in MSDN has a good reference ).

You can build your own custom dignostic classes on top of the built in classes in System.Dignostics namespace.

A couple of very useful tool that you need to have in your grab bag is VS Profiler, and CLR profiler for time profiling and memory profiling respectively.

You can use a profiler to have a general high level idea about your hot functions, you can use StopWatch class to measure the time for some selected methods, or for high resolution timing, you can use QueryPerformanceCounter and QueryPerformanceFrequency windows APIs

mfawzymkh