profiler results for __getattr__, am I reading this correctly ?
Thomas Jensen
thomasNO at SPAM.obscure.dk
Tue Oct 16 21:54:33 EDT 2001
Hi,
I'm working on a Gnutella client, and were beginning to look a bit at
performance.
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
profile.run('Gnutella.main()', '_profile.dat')
stat = pstats.Stats('_profile.dat')
stat.sort_stats('time')
stat.print_stats(30)
This is some of the output from the script:
19102 function calls (14014 primitive calls) in 12.734 CPU
seconds
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
/usr/local/lib/python2.1/asyncore.py:357(__getattr__)
338/90 1.211 0.004 9.992 0.111
/usr/local/lib/python2.1/asyncore.py:75(poll)
954 1.117 0.001 1.117 0.001 GUID.py:20(__repr__)
[snip]
--
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