Opened 10 years ago

Closed 10 years ago

#2987 enhancement closed duplicate (duplicate)

IntNStringReceiver should use a list for its incoming buffer

Reported by: danderson Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Currently twisted.protocols.basic.IntNStringReceiver uses a string to buffer incoming data up to the length of a message. Given that Python strings are immutable, this storage method can result in a lot of GC churn if a message arrives in many pieces.

It would be preferable to use a list of data pieces, and concatenate them all at once when needed. According to http://www.skymind.com/~ocrow/python_string/ this would result in a significant performance boost for the related protocol classes in high data fragmentation situations.

If nobody gets round to it, I'll have some time next week to propose a patch with related benchmarks to verify the performance boost claim (or a negative resolution if the benchmark turns out in favor of the existing implementation).

Change History (2)

comment:1 Changed 10 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

I'll definitely take you up on the offer of benchmarks and implementation. This ticket, however, is a duplicate of #2611.

comment:2 Changed 7 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.