System Clock

Jp Calderone exarkun at intarweb.us
Fri Nov 7 16:19:28 CET 2003


On Thu, Nov 06, 2003 at 10:47:19PM -0500, Terry Reedy wrote:
> 
> [snip]
> 
> (Oddly, I also get this:
> >>> tc()-tc(); tc()-tc()
> -2.84952814126882e-005
> -1.4247640820030938e-005
> which I have not figured out yet)
> 

  I think this indicates there is more than one cost path down into the timing
machinery.  Consider:

>>> time()-time();time()-time();time()-time();time()-time();time()-time();time()-time();time()-time();time()-time();time()-time();time()-time()
-3.9339065551757812e-06
-9.5367431640625e-07
0.0
-1.0728836059570312e-06
-1.0728836059570312e-06
-1.0728836059570312e-06
-9.5367431640625e-07
-9.5367431640625e-07
0.0
0.0

  It appears to me as though making subsequent calls to time.time() in rapid
succession allows one to exploit an optimization somewhere.

  Perhaps some hardware-level caching?

  Jp





More information about the Python-list mailing list