The application I've been working on (a client application that talks with a server backended by a database) is far more responsive when I run the multi-threaded version of the application. It does a lot of concurrent accesses to data on the server (depending on the user context). The multi-threading keeps the UI really responsive and makes it easier to balance what parts of the application run faster than others (simply by controlling how often the thread does its work and what priority it gets).

Overall application performance increases on a multi-processor machine. On my Mac Pro (4 cores) vs. my laptop (1 core), I see substantial gains. However, I have a lot more memory and the processors are faster (also PPC vs. Intel), so that will impact as well. Like Phil and Matt point out, more processors allow for more threads, which means the application can take advantage of threads where needed.

The single-threaded version of the application is much less responsive (even on the multi-processor machine). It is also a lot of work to make sure the event loop gets proper time. I see a lot more "pinwheels of death" on my Mac when running the single-threaded version. Granted, we could probably optimize those instances somewhat. The only reason we even bothered with a single-threaded version was to keep things going until the deadlock problems was resolved.

Summary: It is worthwhile using threads if you do a lot of computation that takes time from the UI. The abstraction makes it easy to move compute intensive code into a thread and then communicate with the main GUI thread when needed (via signals or events). You can even give your threads their own event loop, which creates opportunities for a more refined communication between threads in your application.

--kev

--
Kevin Cureton
Co-Founder
Mind The Gap, Inc.
[EMAIL PROTECTED]
http://www.animationpipeline.com

On Mar 1, 2007, at 3:16 AM, Phil Thompson wrote:

On Thursday 01 March 2007 10:47 am, V. Armando Sole wrote:
Hello,

I just have a simple question (that does not imply a simple answer).

With all the new options/possibilities recently discussed concerning the GIL handling, is it possible to profit of multiple processors in Python
using QThreads thru PyQt4?

The issues of a single GIL haven't gone away. The only difference is that the GIL is (probably) released much more frequently than it was before. The changes are to do with correctness (specifically deadlock avoidance) rather
than performance.

I don't know what the performance effect would be on a multi- processor. Matt said that he could run more threads but I don't know what hardware he has. I noticed a (small) degradation on my uni-processor - as would be expected.

Phil

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to