Profiling is a technique to figure out how time is spent in a program. With this statistics, we can find the “hot spot” of a program and think about ways of improvement. Sometimes, hot spot in unexpected location may hint a bug in the program as well.
In this tutorial, we will see how we can use the profiling facility in Python. Specifically, you will see
– How we can compare small code fragments using
– How we can profile the entire program using
– How we can invoke a profiler inside an existing program
– What the profiler cannot do
Read on for those techniques.