What is the Python equivalent of Matlab’s tic and toc functions?
Apart from timeit which ThiefMaster mentioned, a simple way to do it is just (after importing time): I have a helper class I like to use: It can be used as a context manager: Sometimes I find this technique more convenient than timeit – it all depends on what you want to measure.