| Article: |
Untwisting Python Network Programming | |
| Subject: | Why untwisting? | |
| Date: | 2006-08-13 22:19:59 | |
| From: | Kendrew | |
|
Response to: Why untwisting?
|
||
|
Thank you for pointing out the possibility of TCP segmenting, which may cause problems to dataReceived.
|
||
Showing messages 1 through 2 of 2.
-
performance
2006-08-14 08:16:53 radix [View]
-
Why untwisting?
2006-08-14 08:15:01 glyph@divmod.com [View]
Are you measuring the time it takes to perform a task, or the amount of time it takes to start the interpreter, load every module, perform the task, and shut down the interpreter?
Twisted has more code in it than the Python standard library version, so unless you've carefully optimized the package for importing, the amount of time spent loading code will dwarf the amount of time spent actually doing anything.



I notice that your synchronous version of the telnet code immediately closes the socket whereas the twisted version is waiting for the *server* to end the connection; this could definitely be affecting your times. If you add a transport.loseConnection call after your write call, the semantics should line up better, and I imagine performance will be closer to what we expect.
Also, why are you calling the private "_write" method in the telnet example?