In brief
cProfile records calls and timing across a Python program. It helps locate actual hotspots instead of optimizing by guesswork.
Useful to know
cProfile records calls and timing across a Python program. It helps locate actual hotspots instead of optimizing by guesswork. [1]
Distinguish a function’s own time from time including its subcalls. Profiling itself adds overhead. Compare representative input under a repeatable scenario rather than unrelated tasks that happen to have similar total durations.
Sources
For further detail and to check the information: