Measuring Execution Times
In Python 3.3 and later you can use one of


  time.perf_counter()
  Return the value (in fractional seconds) of a
  performance counter, i.e. a clock with the highest available
  resolution to measure a short duration. It does include time elapsed
  during sleep and is system-wide. The reference point of the returned
  value is undefined, so that only the difference between the results of
  consecutive calls is valid.
  
  time.process_time() Return the value (in fractional seconds) of the
  sum of the system and user CPU time of the current process. It does
  not include time elapsed during sleep. It is process-wide by
  definition. The reference point of the returned value is undefined, so
  that only the difference between the results of consecutive calls is
  valid.


Older Python versions offer timeit.default_timer(), which is now an alias of time.perf_counter().

The timeit module offers tools to get more reliable timings by running the code multiple times.