[Twisted-Python] Why is Int23StringReceiver so slow?

Hello,,
I am designing and implementing a custom protocol using Twisted. I have wanted to design the protocol to use int 32 prefixed strings. I wrote a test version of my server using Twisted's Int32StringReceiver protocol class but it seemed really slow. To test this out I have written and tested two echo servers: one that uses LineReceiver and one that uses Int32StringReceiver. I have benchmarked both of these echo servers by making multiple connections to each. I find that the LineReceiver based echo server is about 200 times as fast as the Int32StringReceiver!
Is the Int32StringReceiver really that slow? Why? What am I missing? Are there hidden assumptions that I am missing? Can it be made faster?
Thanks in advance!
Brian

On Wed, 2005-08-24 at 11:58 -0700, Brian Granger wrote:
Is the Int32StringReceiver really that slow? Why? What am I missing? Are there hidden assumptions that I am missing? Can it be made faster?
There were some optimizations made to LineReceiver that weren't made to Int32StringReceiver, so that may be it.

On Aug 24, 2005, at 12:14 PM, Itamar Shtull-Trauring wrote:
On Wed, 2005-08-24 at 11:58 -0700, Brian Granger wrote:
Is the Int32StringReceiver really that slow? Why? What am I missing? Are there hidden assumptions that I am missing? Can it be made faster?
There were some optimizations made to LineReceiver that weren't made to Int32StringReceiver, so that may be it.
OK, thanks. I will probably just use a line based approach then. Unless I find time to optimize Int32StringReceiver myself.... Until Int32StringReceiver gets optimized, it might make sense to document the fact that it could be very slow compared with LineReceiver.
Brian
Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
Brian Granger
-
Itamar Shtull-Trauring