profiler results for __getattr__, am I reading this correctly ?

Thomas Jensen thomasNO at
Wed Oct 17 03:54:33 CEST 2001


I'm working on a Gnutella client, and were beginning to look a bit at 
After running it through the profiler module, it seems most of the time 
is spent in asyncore.dispatcher's __getattr__ method.
(used for socket pseudo-inheritance AFAIR).
My question is, can this be true?, or am I reading the results 
incorrectly ?
If it turns out that this is my main bottleneck, I might have to move 
away from asyncore (I hope not, asyncore is really cool :-).

My profiling script looks like this:

  import profile
  import pstats
  import Gnutella'Gnutella.main()', '_profile.dat')
  stat = pstats.Stats('_profile.dat')

This is some of the output from the script:

         19102 function calls (14014 primitive calls) in 12.734 CPU 

   Ordered by: internal time
   List reduced from 183 to 30 due to restriction <30>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   3380/1    2.813    0.001   12.609   12.609 
   338/90    1.211    0.004    9.992    0.111 
      954    1.117    0.001    1.117    0.001

Best Regards
Thomas Jensen
(who is not a native english speaker, so please forgive my spelling and 
grammar :-)

More information about the Python-list mailing list