A note on execution times, speed and profiling¶
About (time) profiling with Python (2 or 3):
cProfile
orprofile
in Python 2 documentation (in Python 3 documentation), this StackOverflow thread, this blog post, and the documentation ofline_profiler
(to profile lines instead of functions) andpycallgraph
(to illustrate function calls) andyappi
(which seems to be thread aware).See also
pyreverse
to get nice UML-like diagrams illustrating the relationships of packages and classes between each-other.
A better approach?¶
In January, I tried to use the PyCharm Python IDE, and it has an awesome profiler included! But it was too cumbersome to use…
An even better approach?¶
Well now… I know my codebase, and I know how costly or efficient every new piece of code should be, if I find empirically something odd, I explore with one of the above-mentionned module…