urllib so slow

Alex Martelli aleax at aleax.it
Sun Feb 9 09:53:07 EST 2003


Paul Nilsson wrote:

> Can someone tell me why urllib is so slow? The code below takes over
> 12 seconds to execute just for the google webpage!
> 
> It looks like it takes 5 seconds per 1K, even on local network
> connections. Is there an alternative?

Your machine and/or connection seems to have some problems.  I
just tried your little script:

> import urllib, time
> 
> u = urllib.urlopen("http://google.com")
> 
> start = time.time()
> req = u.readlines()
> print time.time() - start

and, for me (on ADSL), it's printing numbers around 0.027 each
time I run it, on either 2.2.2 or 2.3alpha.


Alex





More information about the Python-list mailing list