[XML-SIG] Python XML Profiling

Dan Gunter dkgunter at lbl.gov
Wed Oct 26 22:08:37 CEST 2005

Have you considered using the Python profiler? A co-worker of mine gave 
a presentation about it that might help you get started.



Dave wrote:

>Hello All,
>I'm trying to profile a Python XML program, but
>getting confused because of the results. It basically
>traverses an XML file. The gprof profiling results are
>as follows:
>% Time  Self Seconds  Calls  Name 
>34.8    0.63                   _moncount
> 10.5   0.19                   mcount
> 10.5   0.19    20,427    _PyEval_EvalFrame
>  3.9    0.07   275,249   _lookdict_string  
>  ...
>  0.0    0.00    11,753   __PyString_Eq
>As I understand, _moncount and mcount are related with
>gprof and _PyEval_EvalFrame is the main interpreter
>loop. It seems this simple program spends a lot of
>time in the interpreter loop. I thought a program
>which handles XML would spend a lot of time on string
>processing, i.e. string matching. In this case, it
>spends just a little time on _lookdict_string, which
>does not even do string matching. However, the string
>matching function (__PyString_Eq) takes negligible
>time. How could this be possible? How does it achieve
>XML processing without exact string matching?
>Thank you for your help!
>Yahoo! FareChase: Search multiple travel sites in one click.
>XML-SIG maillist  -  XML-SIG at python.org

More information about the XML-SIG mailing list