Module: time
The epoch is OS-dependent, and is given by
Module: timeit
Methodology : Decorator and print()
Use: Decorator @timing_func on functions to be timed, which is syntactic sugar for some_func = timing_func(some_func) Note: To preserve attributes of some_func, use @wraps decorator from the functools module on wrapper Methodology: *nix time command
Note: use system /usr/bin/time (man page) rather than shell time, as the former comes with a --verbose option real: wall clock or elapsed time user: amount of time the CPU spent on your task outside of kernel functions sys: time spent in kernel functions Useful for: segregating time my_module.py spends in CPU, from time spent on other kernel-level tasks, or other background processes |
Module: line_profilerPorting from Python2 to Python3: explained in this stackoverflow thread Module: cProfile |
Cheatography
https://cheatography.com
Python Debugging Cheat Sheet (DRAFT) by [deleted]
Useful tools/methods for debugging python code
This is a draft cheat sheet. It is a work in progress and is not finished yet.