M
M
mletov2022-04-07 09:19:11
Debugging
mletov, 2022-04-07 09:19:11

How to get the duration of execution of all methods or the longest executing method?

My challenge is:
Optimize page load execution time. To do this, you first need to find which method or methods take the longest to complete. If there were few methods, the problem would not arise, it is enough to put breakpoints at the beginning and end of the suspicious method and see.
But the project has quite a lot of methods, nested loops, etc.
Tell me, plz, what is the most efficient way to get statistics with the execution time of each method?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2022-04-07
@vabka

You need to do something called profiling.
In VS, as I remember, there is a built-in one, but I don’t remember how to run it.
There is also a separate dotTrace.
With the help of a provider, you will just see which parts of the code take the longest to complete.

O
oleg_ods, 2022-04-07
@oleg_ods

There is a DotNetBenchmark library. It will just allow you to measure the execution time of methods, as well as the number of allocations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question