Hi Chaelon,
C M wrote:
I have a small unfinished application that seems to have an
unexpectedly slow time to start up (by clicking on the Python icon for
the main frame of the application) given how small it is. From a cold
start of not having been run recently, it takes ~37 seconds for the
app to load from the time of clicking to when it is displayed. Then,
after it is closed and reopened, it pops up very quickly, a few
seconds.
This seems really slow to me for such a dinky application, and I've
seen this with many small apps I've made. This application is a frame
(~700 lines) which imports a frame (~500 lines) and a framepanel (~300
lines). It is running with the following specs:
- wxPython 2.8.7.1
- Python 2.5
- Windows XP, SP2
- Gateway Tablet PC, 1.7 Ghz, 512 Meg RAM
- and it import a fair number of modules,
including bigger things like matplotlib and sqlite
I realize that in running the application I am also having to run the
Python interpreter. But are there ways to try to reduce the start up
time of the application or any wxPython application? Some of the
intended apps are to be run at start-up of the computer, and so it is
less important, but generally I'd still like to know ways to reduce
this time if possible.
I just tried my app on my Vista machine, it starts up in about 7 seconds, if I close it and start it again it takes about 5 seconds. On my older Win2000 machine it takes about 15 seconds (512MB Ram, Pentium III), second start is about 8 or 9 seconds). The initial start up brings up the mainframe which has a menu, two sub frames which are hidden (until user selects which one he wants to work with), it connects to the db (Firebird SQL - server version on my Vista machine, FB embedded on the Win2000). As you can see from my numbers there is space for improvement.
As Peter suggested you need to narrow down what is causing this slow start up, I suspect that matplotlib is one of the culprits (I use it too but it only gets loaded if/when user actually wants to look at some graphics).
I know you use Boa, so a good and easy way of finding the culprit(s) is to use the Profiler, i.e. run your application from within Boa by clicking on the Red Arrow with a magnifier glass, after it started just close it and wait a little bit Boa will then show a tap with the times per module and function and .....
I had problems with load times too, so when I did Profile my app I found that e.g. all the dbg statements in masked controls would take a lot of time, after mentioning this to Will Sadkin he made sure that the released version of the controls had all the dbg stuff commented out. I also noticed that my frames which had multiple notebooks and quite a lot of controls on them took a lot of time, so I decided to delay the loading of most of them until the user actually wants to use them. This means a little delay when he uses one but speed up the initial load.
Hope this helps
Werner