[Qgis-developer] Poor asynchronous performance of Python threads?
Charlie Sharpsteen
chuck at sharpsteen.net
Wed Feb 9 00:27:39 EST 2011
Hello list,
I have been playing around with the development branch of IPython (0.11-dev)
as they have built a PyQt-based console that supports all sorts of awesome
features like tab-completion, paged browsing of function code and
docstrings, and Pygments-powered syntax highlighting in addition to the
normal IPython goodness. I slapped together a quick plugin that adds an
IPython-based console to QGIS. The code is available at:
https://github.com/Sharpie/qgis-ipython
To use it, you will need to install ZeroMQ, pyzmq, pygments and the dev
version of IPython from:
https://github.com/ipython/ipython
The console fires up allright, but unfortunately very, very, very slow.
There is about ~1-2 seconds of lag between invoking a command
and receiving a response. For comparison, I threw together a minimal PyQGIS
application that also uses the IPython console:
https://gist.github.com/817914
The PyQGIS version is very snappy and there is no lag. I suspect the
difference is due to the PyQt widget is talking to an external IPython
process through ZeroMQ. When a command is executed, the console sends a
message and then a Python thread waits for the response. With PyQGIS,
Python is controlling the execution of the entire application. However,
when the console is used as a plugin it is running in an embedded
interpreter and it looks like QGIS takes a while to schedule the execution
of the Python threads.
Does anyone have any suggestions for solving or working around this issue?
-Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110208/6d6c549b/attachment-0001.html
More information about the Qgis-developer
mailing list