[Twisted-Python] Performance and select.select

Nitro nitro at dr-code.org
Thu Jan 3 21:42:10 EST 2008


Hello,

I profiled my application with cProfiler. Below is an excerpt from the  
resulting report:

Fri Jan 04 01:07:39 2008    profiling_data_cProfile

          15123197 function calls (14579262 primitive calls) in 228.517 CPU  
seconds

    Ordered by: internal time
    List reduced from 2933 to 50 due to restriction <50>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    138305  135.419    0.001  135.817    0.001 {select.select}
     26168   13.159    0.001   14.044    0.001  
Sources\Server\Plugins\RKSimulation.py:218(UpdatePhysics)

As you can see select.select takes up ~136 of ~229 seconds. This is the  
most expensive function. The row below shows the next expensive function  
which is one of my own. Now I am wondering whether

a) the select calls are really taking up that much time (more than 50%!)
b) if they are taking up that much time I'd like to find out how to reduce  
their execution time (either by minimizing the number it gets called or  
the time it takes to execute etc)

My application doesn't invoke select.select itself so it is most likely  
called within twisted. I am on Windows and using the default reactor  
("from twisted.internet import reactor").

-Matthias




More information about the Twisted-Python mailing list