Profiling Strategy and a Case
Explore how to use unit and functional tests for targeted profiling to identify performance bottlenecks in Python applications. Understand the importance of profiling in production-like environments and learn optimization strategies through a practical case study that improves function speed and overall efficiency.
We'll cover the following...
To profile a program, you need to run it. Nonetheless, running the whole program in profiling mode can generate a lot of data that you do not care about, and this adds noise to what you might be trying to understand. A good strategy to leverage if your program has unit or functional tests is to use them to profile your code. They are little scenarios that can be very useful when you want to obtain profiling data.
Using tests is a good strategy for a curious and naive first-pass at profiling. Though there is no way to make sure that the hot spots seen in the unit/functional tests are the actual hot ...