Hello,

JUAN ERNESTO FLORES BELTRAN wrote:
Hi you all,

I am coding a pygtk/matplotlib/basemap application. Actually i have coded 4,000 lines and i consider 2,000 more lines will be required to finish my application. The point is the application is becoming to slow.

Could you elaborate on this?

I understand that you consider the application as a whole to be not fast enough, but did you perform profiling to identify what part of the program is exactly causing the problem?

Two modules come into mind:
1. Python profiler: see http://docs.python.org/lib/profile.html
2. timeit module, see http://docs.python.org/lib/module-timeit.html

with these, you should be able to determine what part of the program is the problem, so you can concentrate your attention to the point where it makes a difference.

I have done all the stuff required to optimize and minimize the code required to perform tasks such as calculations and vector/array operations which cause memory leak. Despite basemap and matplotlib are "heavy modules" which consume machine resources most of the code (around 80% of the whole program) is related to widgets, boxes, labels, buttons, notebooks, dialogs and all the pygtk code the GUI requires.

In my experience, size of the code in lines says very little about the execution speed. We have several Python programs with thousands lines of code, and find the execution speed satisfactory (ie we have established using profiling that the bottleneck is not in Python).

I wonder how can improve the application performance??. I am thinking of splitting into different modules which can be imported from the main script, so the main script would load/run faster, and the rest of the code will be located in modules wich code will be executed once the user clicks a button or whenever required.

Can any one suggest any way to improve the program performance??

First profile, so you get a handle on what the actual problem is rather than 'somewhere in the program I should change something'. Once you have identified where the problem is exactly, you can think about solving it, and/or ask more specific questions (at the right mailinglist).


Good luck,
Albert
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to