[PyQt] GUI freezing when running large function in QThread

Brent Villalobos Brent.Villalobos at pdi.dreamworks.com
Tue Jul 21 19:09:17 BST 2009


Thanks for the inquires.  Like I said before, I've worked around my 
performance issues.  Now this is only a curiosity for future projects.  
See my comments below.

David Boddie wrote:
> It's not obvious from your description of the problem that the GIL is the
> main cause, though it may be - it depends what your other module is doing.
>   

Unfortunately, I can't recreate my situation since the bottleneck was 
caused in one of our proprietary libraries that is a python API on top 
of a compiled C++ shared object.

> When you said this:
>
>   
>> The problem is that my GUI slows way down where actions like mouse clicks
>> aren't recognized until the validation function finishes.
>>     
>
> it sounds like the behaviour you get when the main thread is being blocked,
> as if you were actually performing the verification in the GUI thread. Can
> you say how you are accessing the fields in your GUI from the validation
> thread?
>   

I'm using a typical model-view-controller architecture where changes to 
one of the GUI fields signals a controller object that will then update 
the model object.  The model object fires off a "modelChanged" signal 
that the controller picks up and will create and start a new validation 
thread if one is not already running.  That validation thread accesses 
the model object.  Is it possible, that since the model is shared 
between the GUI and validation thread, that would be a possible 
bottleneck?  The model is a QObject subclass since it needs to be able 
to fire off the "modelChanged" signal.

> Alternatively, I could imagine that, on some platforms, things that you do
> in the validation thread might affect Qt indirectly. I have vague thoughts
> about X11 here, but perhaps I'm just being paranoid. Which platform are
> you running on?
>   
Red Hat Enterprise Linux 5.

> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>   


More information about the PyQt mailing list