Title: GUI apps take long to launch on Windows
Type: performance Stage: resolved
Components: Windows Versions: Python 3.3, Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ramchandra Apte, brian.curtin, netrick, terry.reedy, tim.golden
Priority: normal Keywords:

Created on 2013-08-04 13:49 by netrick, last changed 2013-08-09 17:46 by terry.reedy. This issue is now closed.

Messages (4)
msg194374 - (view) Author: (netrick) Date: 2013-08-04 13:49
On both Python 2 or 3, when you have GUI app (for example something in pygame or pyside or tk), when you launch it on Windows it takes about 4-6 seconds to display the Window for the first run. The next runs are faster, but only untill you reboot the PC.

The thing is that on Linux even when launching the script for first time ever, the GUI Window shows instantly. 

Something how Python displays windows on Windows is wrong, there is something that causes the serious lag.

You can see it very easy with IDLE. On Linux it launches instantly, on Windows XP on the same PC takes about 6 seconds to launch. I asked other people with different config and they have the same issue on Windows.
msg194382 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-08-04 14:55
Can you provide a short script that reproduces this problem?
AFAIK, Python doesn't display windows, the tcl/pygame libraries' C code creates the windows.
msg194388 - (view) Author: (netrick) Date: 2013-08-04 16:09
The simplest way to reproduce it is:

1) Reboot your PC
2) Launch IDLE (pre-installed with Python)
3) Look how long it takes to launch and then compare that with instant launch on Linux
msg194753 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-09 17:46
This tracker is for patching CPython, not Windows or 3rd-party C libraries. Ramchandra is right, Python does not display windows. In the cases you mention, this is done by 3-rd party cross-platform graphics libraries interacting with Windows' native graphics system. The fact that you have noticed the slow first launch with all 3 suggests that the problem is generic to Windows and how it initializes dlls that connect to Windows graphics system.

I have the impression that this phenomenon is limited neither to Python nor to gui apps. One 'remedy' used by some apps is to load a 'quickstart' background process as part of startup. But that makes the boot or login process longer.

In the absence of evidence that there is anything specifically wrong and fixable in CPython, I am closing this.

Tim or Brian, if either of you think me mistaken, please re-open.
Date User Action Args
2013-08-09 17:46:15terry.reedysetstatus: open -> closed

nosy: + brian.curtin, tim.golden, terry.reedy
messages: + msg194753

resolution: not a bug
stage: resolved
2013-08-04 16:09:59netricksetmessages: + msg194388
2013-08-04 14:55:00Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg194382
2013-08-04 13:49:14netrickcreate