Need to improve COM performance
Tom Fenn
pfenn at mmm.com
Fri Nov 2 10:20:21 EST 2001
Hello,
I'm working on an application that involves calculating some
statistics for data produced by a commercial scientific instrument
(ion trap mass spectrometer). The code works, but takes longer than I
expected to execute. I ran the profiler on it, and got the following
results (which are sorted on cumtime and percall). Access to the data
file is through a COM control provided by the manufacturer. I've
wrapped it using genpy, and then wrapped an easier to use class around
the component. If I read the profile data right, the program is
spending 14 of its 15 minutes of execution time in the ApplyTypes
routine from PythonCOM. Is there anything I can do to speed this up
from within Python? Would implementing the Python class in C++
improve performance significantly in this case? Happily, the
application is spending only a few seconds in my own code.
ncalls tottime percall cumtime percall filename:lineno(function)
0 0 0 profile:0(profiler)
1 0.245 0.245 893.4 893.4 profile:0(r
1 0 0 893.155 893.155 <string>:1(?)
1 1.103 1.103 893.155 893.155 coda.py:4(score)
926 2.159 0.002 888.736 0.96 xcalibur.py:240(XIC)
3704 879.47 0.237 882.8 0.238 __init__.py:342(_ApplyTypes_)
926 0.094 0 875.341 0.945 2DDE1FB3-A60F-11D2-BD82-0060978EEB9Cx0x1x0.py:1412(GetChromatogram)
2778 0.295 0 7.848 0.003 __init__.py:345(__getattr__)
3704 0.539 0 3.854 0.001 __init__.py:91(Dispatch)
3704 0.714 0 3.33 0.001 __init__.py:365(_get_good_object_)
926 1.08 0.001 3.285 0.004 coda.py:19(mcq)
12038 0.571 0 1.921 0 __init__.py:359(_get_good_single_object_)
3704 0.863 0 1.762 0 __init__.py:17(__WrapDispatch)
1852 0.2 0 1.589 0.001 stats.py:231(__call__)
3704 0.327 0 1.553 0 dynamic.py:75(_GetGoodDispatchAndUserName)
3704 1.226 0 1.226 0 dynamic.py:67(_GetGoodDispatch)
926 0.132 0 1.163 0.001 stats.py:2730(astdev)
9260 0.695 0 1.061 0 __init__.py:369(<lambda>)
926 0.281 0 1.031 0.001 stats.py:2705(avar)
3704 0.443 0 0.718 0 gencache.py:117(GetClassForCLSID)
1852 0.361 0 0.548 0 stats.py:2040(amean)
926 0.293 0 0.369 0 Numeric.py:181(convolve)
926 0.196 0 0.366 0 stats.py:4835(ass)
2778 0.36 0 0.36 0 __init__.py:351(__setattr__)
926 0.328 0 0.328 0 xcalibur.py:56(__init__)
1852 0.293 0 0.293 0 stats.py:4774(asum)
1852 0.247 0 0.247 0 Numeric.py:565(sum)
3704 0.182 0 0.182 0 __init__.py:310(__init__)
3704 0.139 0 0.139 0 CLSIDToClass.py:52(HasClass)
3704 0.135 0 0.135 0 CLSIDToClass.py:45(GetClass)
1852 0.126 0 0.126 0 Numeric.py:514(ravel)
1852 0.09 0 0.09 0 __init__.py:129(__getattr__)
926 0.076 0 0.076 0 Numeric.py:122(asarray)
926 0.073 0 0.073 0 2DDE1FB3-A60F-11D2-BD82-0060978EEB9Cx0x1x0.py:4501(IsTraceValid)
930 0.033 0 0.033 0 UserDict.py:14(__getitem__)
926 0.03 0 0.03 0 xcalibur.py:81(AsArray)
More information about the Python-list
mailing list