[PyQt] What happens there's many signals in PyQt?
phil at riverbankcomputing.co.uk
Sat Jul 14 00:19:01 BST 2007
On Friday 13 July 2007 5:18 pm, Carlos Scheidegger wrote:
> > Probably PyQt. If you can produce a simple example that demonstrates the
> > behaviour then I'll have a look at it.
> > Phil
> Ok, this simple example seems to trigger it. I've simply taken tutorial 5
> and added many superfluous QtCore.QObjects and connections. Change line 36
> to "generate_many = False" and things should be back to normal.
> Note that there are many objects being generated: O(2^depth), where depth
> is given in line 37, but only O(log depth) signals being emitted at every
> button click.
> We haven't been able to fully determine what exactly in the system
> configuration triggers this. It certainly seems system or version
> dependent: we have seen this on macs and linux, but not all of the
> machines. In fact, at least one linux and one mac computer does not
> experience the slowness. Even worse, one of the systems that experiences
> slowdown in our main application ("big app") does not experience it in this
> small example ("toy app"), and I couldn't trigger the problem in any small
> Here's the best information we could gather.
> System that doesn't experience slowdown, neither in big app nor toy app:
> AMD64 Opterons, running Ubuntu Feisty, 4GB RAM
> Python: 2.5.1 (r251:54863, May 2 2007, 16:27:44) [GCC 4.1.2 (Ubuntu
> sip: 4.5
> Qt: 4.2.2
> PyQt: 4.1
> System that experiences slowdown in both big app and toy app:
> Xeon, running RHEL4, 6 GB RAM
> system: Linux-2.6.9-55.ELsmp-x86_64-with-redhat-4-Nahant_Update_5
> Python: 2.5.1 (r251:54863, Jun 13 2007, 18:29:50) [GCC 3.4.6 20060404 (Red
> Hat 3.4.6-8)]
> sip: snapshot-20070612
> Qt: 4.3.0
> PyQt: 4-snapshot-20070612
> System that experiences slowdown in big app _but not_ in toy app:
> PowerMac G5 Dual 2.5GHz, 4GB RAM
> system: Darwin-8.10.0-Power_Macintosh-powerpc-32bit
> Python: 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc.
> build 5341)]
> sip: 4.6
> Qt: 4.2.3
> PyQt 4.2
> Let me know if you need more information.
I'm beginning to think this is a Qt problem. I assume the problem is with
creating everything in the first place - I never had any sort of delay
emitting a signal. Attached is my stripped down version or your example.
I find that the delay is about double if the signal is a short-circuit signal
than if it was a Qt signal. As far as sip is concerned the main difference
between those two cases is that an extra QObject is created for the
If I create an additional QObject explicitly just before the connect then the
delay (in the case of the Qt signal) doubles to be about the same as the
short-circuit case. So the problem seems to be too many QObjects, but not
when the object is created but instead when a QObject is connected.
Within sip the code paths are identical once the extra QObject has been
created in the short-circuit case.
I guess a C++ version of the example would prove it really is a Qt problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1037 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070714/3156aee9/test_signals.bin
More information about the PyQt