I assume that there is a stage in the application that takes too much time - i.e. makes you wait. I guess you really want to see what you can change to make it faster.
Used technique random suspension . You start the application under the debugger and, in terms of its execution, make you wait, pause it and check the call stack. Do this several times.
Here are some ways your program can spend more time than necessary.
- I / O that you did not know and did not need.
- Very often select and release objects.
- Track data structure notifications.
- others are too numerous to mention ...
No matter what it is, when it happens, a call stack check will show it. Once you know what it is, you can find a better way to do it, or maybe not do it at all.
If the program takes 5 seconds, when it can take 1 second, the probability that you will see a problem at each pause is 4/5. In fact, any function call that you see in a few stack examples, if you could avoid this, will give you significant speedup. And thus, almost all possible bottlenecks can be found.
Do not think about timings of functions or how many times they are called. Look for lines of code that often appear on the stack that you don't need.
Example Added: If you take 5 samples of the stack, and a line of code appears on them, then it is responsible for about 2/5 = 40% of the time, give or take. You do not know the exact percentage, and you do not need to know. (Technically, the average is (2 + 1) / (5 + 2) = 3/7 = 43%. Not bad, and you know exactly where.)
source share