[issue2632] performance problem in socket._fileobject.read

Gregory P. Smith report at bugs.python.org
Mon Apr 21 20:00:58 CEST 2008


Gregory P. Smith <greg at krypto.org> added the comment:

Twisted fixed their problem for issue 1092502 by making recv()ed data
short lived by putting it into a StringIO for buffering.

I've attached a patch that does that for the socket module -and- gets
rid of any possibility of doing tiny size recvs in read() which is the
cause of the poor performance that this issue was filed about.

My patch also documents what _rbufsize is used for (readline) and makes
sane use of it with read.

When viewing the change, it is best to view it side by side next to the
old version rather than trying to comprehend it as a diff.

I believe this really fixes both issue 1092502 while at the same time
prevents introduction of a speed problem (this issue).

----------
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith
Added file: http://bugs.python.org/file10071/socket-strio-gps01.patch.txt

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2632>
__________________________________


More information about the Python-bugs-list mailing list