fix many LineReceiver slowdowns and bugs

[email protected]
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from ivank <[email protected]>:

LineReceiver can be slowed down by various input in three different ways.

The attached implementation:

        does not rely on string concatenation optimizations available in
        CPython 2.5+ and other implementations.

        stays fast when `data' contains many lines delivered at once, unless
        there is excess toggling between line mode and raw mode, with a large
        `extra' being passed to setLineMode each time.
            (note: many lines at once will be slow if Python is missing
            collections.dequeue, available since CPython 2.4)

        searches for the delimiter only in recently-received data, preventing
        unnecessary searching of the delimiter in a long buffer.

The attached implementation also fixes #3277 and #3050 and probably fixes #3353 because it no longer erroneously rejects lines under the MAX_LENGTH.

A related ticket is #2611 which is focused on fixing O(N**2) behavior in all protocols in protocols.basic

----------
Type     : defect
Component: core
Keywords : 
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/3803
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.