How to accelerate python application GUI speed

Brian Kelley bkelley at wi.mit.edu
Wed Sep 3 16:46:59 EDT 2003


You will always take a hit using threading and a gui.  I agree with your 
complaints about wxPython's size though.  I'm not quite sure what you 
mean by wxPython is "slow" though.  Do you mean that running your code 
inside wxPython is slow?

Qualitatively, when using wxPython and QT I've encountered about a 30% 
speed hit when using threads.

I'll assume that your bit-torrent code has a pretty simple interface, 
such as "download this file to here", "I'm X percent done" and "cancel 
the download"

If this is the case, you might be interested in using wxProcess to spawn 
a new python process and then monitor the new processes stdout to update 
a progress bar or a dialog box.

The benefits are as follows:
1) Easy to kill a process.
2) The process doesn't get blocked by the GIL and can run with (just 
about) full CPU power.

Downsides:
1) python needs to be in your path and the python path has to be
  set up correctly to load your code.
2) wxProcess doesn't work on OS X yet.

My code is pretty ugly, but I am using it in a production environment. 
Let me know if you want me to post it here (it comes with an example).

-- 
Brian Kelley                                  bkelley at wi.mit.edu
Whitehead Institute for Biomedical Research   617 258-6191





More information about the Python-list mailing list