PyMOTW: timeit

The timeit module provides a simple interface for determining the execution time of small bits of Python code. It uses a platform-specific time function to provide the most accurate time calculation possible.

Read more at pymotw.com: timeit