![]() |
Python Qt startup time tips
Hi Guys
Just did some experiments on Python Qt startup times. ncalc currently takes 3 seconds to startup from terminal. I just managed to improve this to 2 seconds by making a small change to the import statement in my main.py :D from Code:
from PyQt4 import QtCore,QtGuiTo Code:
from PyQt4 import QtCore |
Re: Python Qt startup time tips
Intresting!
|
Re: Python Qt startup time tips
Did you try with pyside, as the last try i made i think it was a bit too slow just to start up to make real applications.
|
Re: Python Qt startup time tips
@mikec: another trick if your main() is big to put it in a separate file (as only import-ed things can be saved parsed). Then there is pylauncher, but it's been a while since it was updated, not sure if it works on the N900/PyQt/PySide out of the box.
@Khertan: until a Shiboken based version is released, it's going to be slow, the binaries are huge. |
Re: Python Qt startup time tips
I thought PyLauncher was Gtk Only?
@Khertan, no have not used Pyside just yet, though itchy to get to PR1.2, Qt4.6 and then Pyside we assume will be along soon. |
Re: Python Qt startup time tips
Yeah, originally, but there is nothing preventing the same concept to be applied to Qt bindings (or any other module for that matter). It will take a few more days after PR1.2 till we get a fully functional Shiboken based PySide, though. So there is still purpose to good ole PyQt....
|
Re: Python Qt startup time tips
And, before I forget, there is a trick to load an image before your app starts so it looks faster than it is (the application manager does this). Not sure how we can make that thingy cooperate with Qt...
See this thread: http://lists.maemo.org/pipermail/mae...er/021332.html |
Re: Python Qt startup time tips
Quote:
http://lists.openbossa.org/pipermail...ch/000492.html Suddenly I'm wishing I didn't clobber my scratchbox setup. I'm itching to try this out. |
Re: Python Qt startup time tips
Yay ! Time to make some benchmarks !
|
Re: Python Qt startup time tips
Mhh, interesting...
When I stripped down all the QT modules to the required ones in each of my modules I got a very, very tiny speedup for the startup time (which might be in the range of error) For the second run, when the .py files are already byte-compiled, there is no difference at all. So I guess, best practice would be to distribute the programs pre-compiled as .pyo (.pyc) For version 1.0.1 I just had this in each of my modules (besides some other stuff): Code:
from PyQt4 import QtCore, QtGuiCode:
from PyQt4 import QtCoreFirst launch: www2sms-1.0.1 $ time python www2sms.py real 0m 2.62s user 0m 1.94s sys 0m 0.21s USER + SYS = 2.15s www2sms-1.0.2 $ time python www2sms.py real 0m 2.17s user 0m 2.00s sys 0m 0.14s USER + SYS = 2.14s Second launch: www2sms-1.0.1 $ time python www2sms.py real 0m 2.00s user 0m 1.84s sys 0m 0.16s USER + SYS = 2.0s www2sms-1.0.2 $ time python www2sms.py real 0m 2.02s user 0m 1.84s sys 0m 0.16s USER + SYS = 2.0s By the way, where is the pstats module for python? python -m cProfile www2sms.py [...] ImportError: No module named pstats Cheers Bjoern |
| All times are GMT. The time now is 10:32. |
vBulletin® Version 3.8.8