Calculating Elapsed Time
grante at visi.com
Wed Dec 7 18:34:12 CET 2005
On 2005-12-07, Fredrik Lundh <fredrik at pythonware.com> wrote:
>>> if I run this on the Windows 2K box I'm sitting at right now,
>>> it settles at 100 for time.time, and 1789772 for time.clock.
>>> on linux, I get 100 for time.clock instead, and 262144 for
>> At least under Linux, I suspect you're just measuring loop time
>> rather than the granularity of the time measurement.
> Yeah, I said it was silly. On the other hand, the Linux box is a lot faster
> than the Windows box I'm using, and I do get the same result no matter
> what Python version I'm using...
> (and in this context, neither 262144 nor 1789772 are random numbers...)
262144 is 3.8us. That seems pretty large. What do you get
when you do this:
for i in range(10):
After the first loop, I usually get one of three values:
3.099us, 2.14,us, 2.86us.
In any case, the resolution of time.time() _appears_ to be less
Grant Edwards grante Yow! Alright,
at you!! Imitate a WOUNDED
visi.com SEAL pleading for a PARKING
More information about the Python-list