[Pythonmac-SIG] socket.getaddrinfo problems

Dudley Carr dudley at cs.stanford.edu
Thu Apr 15 18:39:06 EDT 2004


Hi,

I have an RSS reader written in Python that's performing poorly on OS X Panther. 
I've managed to track it down to getaddrinfo. I tried the same code on Windows 
with Python 2.3.3 and the look-ups are a fraction of what they are on OS X, so I 
don't believe it's a problem with my network configuration.

I've run the code snippet below several times on different domains with the same 
results. Can anyone else confirm the timings that I'm getting below?

Regards,
Dudley

 >>>import socket,time
 >>> def getaddrinfoTest(count):
...     for i in range(count):
...             start = time.time()
...             socket.getaddrinfo('yahoo.com', 80)
...             end = time.time()
...             print 'time =', end - start
...

 >>> getaddrinfoTest(20)
time = 0.191851854324
time = 3.05499100685
time = 5.86090803146
time = 11.3977048397
time = 0.239115953445
time = 0.263440847397
time = 0.304595947266
time = 0.296709060669
time = 0.2084441185
time = 0.248239040375
time = 0.26735496521
time = 0.137476205826
time = 0.342806100845
time = 8.5551700592
time = 1.53769421577
time = 3.022397995
time = 9.31026601791
time = 3.00104379654
time = 6.08663797379
time = 0.202562093735



More information about the Pythonmac-SIG mailing list