urllib so slow

Skip Montanaro skip at pobox.com
Sat Feb 8 15:43:15 EST 2003


    Paul> Can someone tell me why urllib is so slow? The code below takes
    Paul> over 12 seconds to execute just for the google webpage!

Perhaps something platform dependent or you just hit a slow combination of
google server and/or network congestion?  On my Mac OS X system conencted
via cable modem I get respectable results:

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

I'm using the CVS head, but 2.2.2 isn't much worse:

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

Skip





More information about the Python-list mailing list