When working on improving existing code, there is always the question of how to measure results. There are numerous ways to do this, for example, visually assessing improvements, getting feedback from users, using the code profiler and/or trace parser, and various other methods.
In this recipe, we will discuss how to measure the code execution time using a very simple method, just by temporarily adding a few lines of code. In this way, the execution time of the old code can be compared with that of the new one in order to show whether any improvements were made.