I used GlowCode (a commercial product similar to Sleepy) to profile my own C ++ code. You start the setup process, then execute your program, and then look at the data received by the tool. The instrumental step introduces a small trace function to the access points and access points of each method and simply measures how long it takes to complete each function.
Using the call graph profiling tool, I listed the methods sorted from "most used time" to "least used time", and the tool also displays the number of calls. Simple drilling in the highest percentage routine showed me which methods used the most time. I saw that some methods were very slow, but in them I found that they were waiting for user input or for a service response. And some took a long time because they called several internal procedures thousands of times each call. We found that someone made a coding error and went over to the large linked list many times for each item in the list when they really only needed to go through it once.
If you sort the “most often called” into the “least called”, you can see some of the tiny functions that are called from everywhere (iterator methods like next() , etc.). Something to check is to make sure the functions that are most often called are really clean. Saving a millisecond in a routine called 500 times to draw a screen will speed up that screen by half a second. This will help you decide which of the most important places you spend.
I saw two general approaches to using profiling. One of them is to perform "general" profiling by performing a set of "normal" operations and discovering which methods slow down the application the most. Another is to do specific profiling, focusing on specific user complaints about performance and skipping these features to identify their problems.
One thing I would like to warn about is to limit your changes to those that will noticeably affect user experience or system bandwidth. Shaving one millisecond with the mouse will not make any difference to the average user, because human reaction time is simply not that fast. Racing drivers have a reaction time of 8 milliseconds, some elite gamers are faster, but ordinary users, such as bank meters, will have a reaction time in the range of 20-30 milliseconds. The benefits will be negligible.
Creating twenty 1 millisecond enhancements or one change in 20 milliseconds will make the system more responsive. It is cheaper and better if you can make one big improvement over many small improvements.
Similarly, shaving one millisecond from a service that processes 100 users per second will make a 10% improvement, which means you can improve service to handle 110 users per second.
The reason for concern is that changes to the encoding strictly to improve performance often negatively affect the structure of your code, adding complexity. Let's say you decide to improve the database call by caching the results. How do you know when a cache is invalid? Are you adding a cache cleanup mechanism? Consider a financial transaction in which cyclic movement across all positions to create a total amount will be slow, so you decide to keep an accelerated working battery. Now you need to change runTotal for all kinds of situations, such as linear voids, turns, deletions, modifications, changes in quantity, etc. This makes the code more complex and error prone.