开发者

Numeric GUI bottleneck

I've made a GUI to set up and start a numerical integrator using PyQT4, Wing, QT, and Python 2.6.6, on my Mac. The thing is, when I run the integrator form the GUI, it takes very many times longer than when I crudely run the integrator from the command line.

As an example, a 1000 year integration took 98 seconds on the command line and ~570 seconds from the GUI.

In the GUI, the integration runs from a thread and then returns. It uses a a queue to communicate back to the GUI.

Does anyone have any ideas as to where the bottleneck is? I suspect that others 开发者_Go百科may be experiencing something like this just on a smaller scale.

t = threading.Thread(target=self.threadsafe_start_thread, args=(self.queue, self.selected))
t.start()


In general it is not a good idea to use python threads within a pyqt application. Instead use a QThread.

Both python and QThreads call the same underlying mechanisms, but they don't play well together. I don't know if this will solve your problem or not, but it might be part of the issue.


Is your thread code mostly Python code? If yes, then you might be a victim of the Global Interpreter Lock.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜