Python Timing - time.clock() vs. time.time()
Python Timing - time.clock() vs. time.time()
Submitted by noreply@blogger.com (Corey Goldberg) on Wed, 17/09/2008 - 16:56.Dear Lazyweb,
Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy?
for example:
start = time.clock() ... do something elapsed = (time.clock() - start)
vs.
start = time.time() ... do something elapsed = (time.time() - start)
Update:
From the comments I received and others I have talked with, it looks like the answer is: use time() on Unix/Linux systems and clock() on Windows systems. However, the 'timeit' module gives you more options and is accurate across platforms.
