[PyQt] help with performance issue

Matt Chambers chambers at imageworks.com
Mon Apr 11 20:31:11 BST 2011

I'm hoping there is a PyQt historian out there that can answer this 
question for me.

We have a major  application that we've been unable to use anything 
beyond Pyqt 4.3 due to what I think is a performance issue with 
setVisible.  I'd like to give an example but this is proprietary code 
and I can't seem to get a simple example to exhibit the problem without 
bringing in the kitchen sink, I'm working on it though.  What I do have 
is some cProfile numbers.  It doesn't really matter what version of Qt 
or python we use. (You can assume we've tested many of them over the 
years) Currently we're using Qt 4.5.2 and python 2.6.4.

What we have is somewhat of a disclosure widget that when clicked will 
show some data and/or more disclosure widgets. In 4.7, cProfile shows 
PyQt spending a lot more time in '<built-in method setVisible>.  In this 
test, I clicked the "show" button once to show a large amount of data, 
then clicked it again to hide it, so the number of calls to setVisible is 2.

In 4.7.3:
CumulativeTime: 0.9463
Time/Call: 0.4732
Total Time: 0.6062
Per/Call: 0.3031

In 4.3.3:
CumulativeTime: 0.5250
Time/Call: 0.2625
Total Time: 0.0435
Per/Call: 0.0217

The "total time" is time spent in a given function, excluding time spent 
in sub functions. As you can see, there is a major discrepancy between 
the total time in setVisible for 4.3 and 4.7.  This translates into a 
slight delay when we're opening just 1 level, but if we 'expand all' a 
large structure, then it becomes very apparent something is wrong.


More information about the PyQt mailing list