urllib slow on FreeBSD 4.7? sockets too
Mike Brown
mike at skew.org
Sat Nov 23 04:51:50 EST 2002
"Jarkko Torppa" <torppa at staff.megabaud.fi> wrote:
> Seems that stdio is somehow confused, try this
>
> import urllib, time, os
>
> starttime = time.time()
> u = urllib.urlopen('http://localhost/4m')
> fn = u.fp.fileno()
> bytea = [ ]
> while 1:
> bytes = os.read(fn, 16 * 1024)
> if bytes == '':
> break
> bytea.append(bytes)
> bytes = ''.join(bytea)
> u.close()
[...]
Well, look at that...
bytes: 4241.5K; time: 0.322s (13171 KB/s)
That's much better. At least, it now seems to be hitting the socket speed
cap.
Thanks!
More information about the Python-list
mailing list