المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Visual Studio 2010 Profiler



C# Programming
06-18-2011, 07:32 PM
Do any of you use the VS2010 Profiler regularly? If so, in what cases do you use it? I know there are plenty of paid profilers around, as well as free (IIRC, not entirely sure).

I ask because I recently ran into some terribly slow performance in a database-driven application. I did not have access to any 3rd-party profiling applications. So I ran the profiler in VS. It helped me discover that I had mistakenly created a loop which opened the database connection, queried it and the closed the connection for EACH iteration in the loop. This took approximately 27 seconds seeing as how there was close to 2,000 records in the table. The profiler told me that the majority of the time was taken up by DbConnection.Disconnect() inside this method. That's when I found the problem. Once I fixed it I can now run the same code with MORE THAN 2,000 records in the table and it takes ~7 seconds.

I think I should start using the profiler more often. Haha. Any input would be nice. I wasn't entirely sure if this was the correct forum but I develop C# applications.