If you just want to see the profiler output, this is one thing. If you are trying to optimize your code, do not forget about this method . I know you can do this in xdebug.
This is based on a very simple idea. Suppose your program does more than you need, so you can speed it up. In fact, suppose that for argumentation it does 9 times more than necessary, so if it were to take 1 second, it actually takes 10. These 9 seconds of unnecessary work may or may not be thoroughly mixed, like sugar and flour .
OK, in these 10 seconds you just press ^ C to stop it, and then carefully look at what it is doing at that moment.
What is the likelihood that you caught him doing a wasteful thing? In fact, it is very unlikely that you did not catch him doing a wasteful thing.
If you are not sure, just repeat.
Waste should not be so large. In fact, if you continue to pause as soon as you see that he does something more than once, if this is something that you can get rid of, you will get good acceleration guaranteed.
For example, if you pause it 5 times, and you see that he is doing something that he really does not need to do in 2 of these cases, how much could you save? You donโt know for sure, but it will be somewhere around 40%. It may be only 20%. It can be as easy as 60%. So you donโt know how much it will save, but you donโt throw out the gold nugget just because you donโt know how much it weighs.
Finally, there is no problem with which the profiler can find that this will not happen. The converse is not true.