[ZODB-Dev] Test Failure

Tim Peters tim@zope.com
Fri, 31 May 2002 09:18:34 -0400


[Chris Withers]
> Hmmm... so does this mean the resolution problem lies in Python's
> time module?!

The only resolution problem is code *assuming* finer resolution than may
exist.  This is easy to fall into if testing on only one box.  The C
standard doesn't require any minimum level of resolution in any of its time
gimmicks, and platform C libraries vary wildly in what they supply.  Between
Linux and Windows, the relative advantage varies according to which Python
time function you use:

              typical update rate
          time.time()    time.clock()
          -----------    ------------
Linux          1 MHz       100  Hz
Windows     18.2  Hz       1.2 MHz

In addition, time.clock() usually measures user CPU cycles on Unixish boxes,
but an approximation to wall-clock time on Windows.

High-resolution timing is a PITA across boxes.  Python endures considerable
pain to hide this, but not heroic pain.