Hi experts,

 

I wrote a TCP client program used twisted to receive lots of data from the 
server and decode them for analysis.

But the efficiency is ugly.

I used “profile” and “pstats” to analysis and found selectreactor.py is time 
consuming.

what is selectreactor.py used for?

How can I improve that? 

Very thanks.

 

2012-03-13 17:46:10+0800 [-] Tue Mar 13 17:46:10 2012    astar_prof.txt

2012-03-13 17:46:10+0800 [-] 

2012-03-13 17:46:10+0800 [-]          9111 function calls (9070 primitive 
calls) in 119.166 CPU seconds

2012-03-13 17:46:10+0800 [-] 

2012-03-13 17:46:10+0800 [-]    Ordered by: internal time

2012-03-13 17:46:10+0800 [-]    List reduced from 496 to 15 due to restriction 
<15>

2012-03-13 17:46:10+0800 [-] 

2012-03-13 17:46:10+0800 [-]    ncalls  tottime  percall  cumtime  percall 
filename:lineno(function)

2012-03-13 17:46:10+0800 [-]       171  119.092    0.696  119.094    0.696 
:0(select)

2012-03-13 17:46:10+0800 [-]       156    0.005    0.000    0.007    0.000 
http.py:225(datetimeToLogString)

2012-03-13 17:46:10+0800 [-]         4    0.005    0.001    0.007    0.002 
protocol.py:131(dataReceived)

2012-03-13 17:46:10+0800 [-]       171    0.004    0.000    0.029    0.000 
base.py:718(runUntilCurrent)

2012-03-13 17:46:10+0800 [-]       324    0.004    0.000    0.004    0.000 
:0(append)

2012-03-13 17:46:10+0800 [-]       160    0.004    0.000    0.004    0.000 
:0(heappop)

2012-03-13 17:46:10+0800 [-]       171    0.004    0.000  119.114    0.697 
selectreactor.py:93(doSelect)

2012-03-13 17:46:10+0800 [-]       164    0.003    0.000    0.003    0.000 
:0(heappush)

2012-03-13 17:46:10+0800 [-]       342    0.003    0.000    0.006    0.000 
base.py:699(_insertNewDelayedCalls)

2012-03-13 17:46:10+0800 [-]       342    0.003    0.000    0.003    0.000 
:0(keys)

2012-03-13 17:46:10+0800 [-]       358    0.002    0.000    0.002    0.000 
:0(fileno)

2012-03-13 17:46:10+0800 [-]       163    0.002    0.000    0.005    0.000 
base.py:648(callLater)

2012-03-13 17:46:10+0800 [-]      19/1    0.002    0.000    0.003    0.003 
xml2dict.py:16(_parse_node)

2012-03-13 17:46:10+0800 [-]       686    0.002    0.000    0.002    0.000 
:0(time)

2012-03-13 17:46:10+0800 [-]        51    0.002    0.000    0.003    0.000 
:0(encode)

2012-03-13 17:46:10+0800 [-]

Best

Regards,

 

Xiao Peng(肖鹏)

Cisco Systems

GSP-Beijing (China)

Office: +86 10 8507 7181

Mobile: +86 18600560077(preferred)

 

_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
  • [Twisted-Python] How to Im... Peng Xiao -X (penxiao - Digital China at Cisco)

Reply via email to