Light Speed Socket Connections

Bengt Richter bokr at accessone.com
Thu Jul 12 04:37:52 EDT 2001


On 11 Jul 2001 22:32:16 -0700, tangell at kicker.com (T Angell) wrote:

>I wrote some code to test how long it takes to make socket connections
>and ran it against several hosts around the world, here are some
>sample times:
>
>socket time: 0.0047459602356
>socket time: 0.00469899177551
>socket time: 0.00404000282288
>socket time: 0.00537407398224
>
[...]
>  t1 = time.time()
For accurate timing, time.clock()
is recommended, I believe:

"""
clock() 
    Return the current CPU time as a floating point number expressed in seconds.
    The precision, and in fact the very definition of the meaning of ``CPU time'',
    depends on that of the C function of the same name, but in any case, this
    is the function to use for benchmarking Python or timing algorithms. 
"""
"""
time() 
    Return the time as a floating point number expressed in seconds since the epoch,
    in UTC. Note that even though the time is always returned as a floating point number,
    not all systems provide time with a better precision than 1 second.
"""



More information about the Python-list mailing list