Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to find long-running code in a Windows Forms Application

Tags:

.net

vb.net

I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest subroutines and tackle them first in an attempt to speed up the app.

I know that there are several code profiler products available for purchase which will show how long each subroutine takes, but I was hoping to find a free solution.

like image 276
PaulStock Avatar asked Aug 06 '08 20:08

PaulStock


People also ask

How to use Performance Profiler?

Open the Performance Profiler by choosing Debug > Performance Profiler (or Alt + F2). The tool shows each async operation in a list view. You can see information such as the start time, end time, and total time for an async operation.

What is profiler C#?

A profiler is a tool that monitors the execution of another application. A common language runtime (CLR) profiler is a dynamic link library (DLL) that consists of functions that receive messages from, and send messages to, the CLR by using the profiling API. The profiler DLL is loaded by the CLR at run time.


3 Answers

I appreciate the desire to find free software. However, in this case, I would strongly recommend looking at all options, including commercial products. I tried to play with nProf (which is at version 0.1 I think) and didn't have much luck. Even so, performance profiling an application is a subtle business and is best approached using a powerful, flexible tool. Unless you are working for free, I strongly believe the time you will save using a professional product will far outweigh the cost of a license. And of course, if you are only wanting to profile a single application, each commercial package has a 15 or 30 day trial, more than enough time to pinpoint any issues in an existing application. And if you need profiling support for more than just the one-off project, you're better buying a full strength tool anyway.

We use the ANTS profiler from RedGate and have been very happy with it. I have also used .NET Memory Profiler with excellent results. The cool thing about .NET Memory Profiler is that it can attach to and profile running production applications, which really saved our butts when we had a memory leak in production we couldn't reproduce in our test lab.

The JetBrains folks have a profiler as well called dotTrace which I haven't tried, but I have to believe that if it comes from the JetBrains shop it is probably top notch as well.

Anyway, my advice is this: try to fix your app within the free trial window of one or an aggregated combination of the three of them (minimum of 45 days free use) and if that isn't enough time, pick your favorite and spring for one of them. You won't be sorry.

like image 56
Nathan Avatar answered Oct 27 '22 01:10

Nathan


nProf is a free .Net profiler (ref).

like image 29
Yaakov Ellis Avatar answered Oct 27 '22 01:10

Yaakov Ellis


nProf is a good, free tool for .Net Profiling.

like image 34
Greg Hurlman Avatar answered Oct 26 '22 23:10

Greg Hurlman