[Twisted-Python] Re: [Twisted-commits] r10475 - Use writeSequence instead of silly for-loop.

exarkun at divmod.com exarkun at divmod.com
Thu Apr 15 20:09:56 MDT 2004


On Thu, 15 Apr 2004 13:27:56 -0400, James Y Knight <foom at fuhm.net> wrote:
>
> On Apr 5, 2004, at 10:36 AM, Andrew Bennetts wrote:
> 
> 
> This is of course quite silly, and I suspect a nice performance 
> enhancement could be achieved by making FileDescriptor.dataBuffer be a 
> list of strings, rather than a single string. That would both cause 
> multiple writes in a row to not allocate new strings, and allow 
> writeSequence to be implemented sanely.

  Been there :)  FileDescriptor.dataBuffer was a list when I first started hacking around in Twisted's internals.  The current implementation is the result of an optimization of that code, and is somewhat (not earth-shatteringly) faster.

> 
> Doesn't look very hard really; looks like you'd only need to touch 
> write/writeSequence/doWrite. This'd also have the advantage of making 
> it easier to put a Sendfile-struct in there as well. So pahan's 
> volunteered to fix this!

  There are a few other places that need to be touched, but it is certainly doable.  The main problem is simply that tcp.py is such a mess.

  Jp




More information about the Twisted-Python mailing list