Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is PyQt application startup so slow?

C++ is fast. Qt is fast. Python interpreter startup is relatively fast (2-3 seconds on my computer). PyQt is thin wrapper around Qt. Why then PyQt app startup (about 80 lines, even in .pyc form) is so slow (6-12 seconds)? I'm interested in reasons for this and, most importantly, ways to improve this situation.

like image 420
DSblizzard Avatar asked Oct 22 '10 06:10

DSblizzard


1 Answers

There is a known bug in Qt 4.6.3 that cripples application start times. Maybe 4.4.3 is also affected. Try to upgrade to 4.7.0, which fixes that bug.

Your problem might also come from dynamic library relocation. If you compile either Qt or Python yourself, try to give them a base address different from the default (0x10000000), to prevent relocation to occur when the two libraries are loaded together.

Under Linux, you could have used prelink, but to my knowledge it has no equivalent on Windows.

like image 159
Frédéric Hamidi Avatar answered Sep 18 '22 09:09

Frédéric Hamidi