View Single Post
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#10
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, QtGui
sys.exit()
For version 1.0.2 I stripped the QT modules down to the required ones only:
Code:
from PyQt4 import QtCore
from PyQt4.QtGui import QApplication, QMainWindow, QDialog, QPushButton, QMessageBox
sys.exit()
(Some modules requred more, some less Qt modules)

First 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

Last edited by blubbi; 2010-05-17 at 23:38.