urllib so slow

Paul Nilsson python.newsgroup at REMOVE.paulnilsson.com
Tue Feb 11 06:09:49 EST 2003


On Sun, 09 Feb 2003 14:53:07 GMT, an infinite amount of monkeys
hijacked the computer of Alex Martelli <aleax at aleax.it> and wrote:

>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

It seems the problem is buffering, the fix in this thread seems to
work fine. Seems to be a lot of network activity without the fix, this
is on win98 (not SE) so perhaps it's OS related.

cheers, Paul




More information about the Python-list mailing list