Looking for insight: processEvent() slowing down
-
Hi everyone,
I’m currently blocked by a Qt related issue and would like to know if anyone is familiar with kind of issue.In short, my whole app is slowing down when cycling a bit of code that simple toggles visibility of a couple QDockWidget & QFrame
Anytime I use an eventloop to wait for a signal, or call processEvent() I notice that this is taking longer with every new cycle.It seems to be created by the GUI redisplay when hiding/showing the widgets.
The thing is I used to cycle the app with QtScript and all was fine.
I had to implement OLE for a customer, and now the problem arise, although I’m calling the exact same functions.The cycling is performed with a timer in both case, so the app should have enough time to process pending events between two cycles.
I’m not even sure why processEvent() is taking more and more time, would anyone have any insight how to tackle this issue?Thanks in advance
-
Hi everyone,
I’m currently blocked by a Qt related issue and would like to know if anyone is familiar with kind of issue.In short, my whole app is slowing down when cycling a bit of code that simple toggles visibility of a couple QDockWidget & QFrame
Anytime I use an eventloop to wait for a signal, or call processEvent() I notice that this is taking longer with every new cycle.It seems to be created by the GUI redisplay when hiding/showing the widgets.
The thing is I used to cycle the app with QtScript and all was fine.
I had to implement OLE for a customer, and now the problem arise, although I’m calling the exact same functions.The cycling is performed with a timer in both case, so the app should have enough time to process pending events between two cycles.
I’m not even sure why processEvent() is taking more and more time, would anyone have any insight how to tackle this issue?Thanks in advance
@JulienMaille
Are you able to see whether the process size (memory usage) is growing all the time together with the slow downs? -
@JulienMaille
Are you able to see whether the process size (memory usage) is growing all the time together with the slow downs?@JonB It is not growing significantly.
However I was just able to stop the application in debug and the code I was in show an every growing postEventList.
It seems to be filled with QPropertyAnimation for GUI elements resizing.void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerId) { QThreadData *data = object->d_func()->threadData; QMutexLocker locker(&data->postEventList.mutex); if (data->postEventList.size() == 0) return; for (int i = 0; i < data->postEventList.size(); ++i) { const QPostEvent & pe = data->postEventList.at(i);
-
@JonB It is not growing significantly.
However I was just able to stop the application in debug and the code I was in show an every growing postEventList.
It seems to be filled with QPropertyAnimation for GUI elements resizing.void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerId) { QThreadData *data = object->d_func()->threadData; QMutexLocker locker(&data->postEventList.mutex); if (data->postEventList.size() == 0) return; for (int i = 0; i < data->postEventList.size(); ++i) { const QPostEvent & pe = data->postEventList.at(i);
I had to implement OLE for a customer, and now the problem arise, although I’m calling the exact same functions.
may be the root of the issue. Presumably either you shouldn't be getting the events or they are not being handled. Hence you're slow!
Wait for one of the Qt experts to browse along to this post....
-
Well I'm affraid experts in OLE are not browing this forum. However any tip to debug the clogged eventLoop will be appreciated.
EDIT: so with a bit of fiddling, I found out this has to do with QTimer deletion not happening. This timers being created to perform the animated resizing of widgets.
Calling manuallyQCoreApplication::processEvents(QEventLoop::DeferredDeletion)
in my OLE object will flush the eventLoop, however this sounds like a dirty workaround. -
Hi,
Out of curiosity, how are you using these timers ?
-
Well I'm affraid experts in OLE are not browing this forum. However any tip to debug the clogged eventLoop will be appreciated.
EDIT: so with a bit of fiddling, I found out this has to do with QTimer deletion not happening. This timers being created to perform the animated resizing of widgets.
Calling manuallyQCoreApplication::processEvents(QEventLoop::DeferredDeletion)
in my OLE object will flush the eventLoop, however this sounds like a dirty workaround.@JulienMaille Could you simply re-use the same QTimer object, instead of creating new ones?
-
@JulienMaille Could you simply re-use the same QTimer object, instead of creating new ones?
@SGaist said in Looking for insight: processEvent() slowing down:
Hi,
Out of curiosity, how are you using these timers ?
@JKSH said in Looking for insight: processEvent() slowing down:
@JulienMaille Could you simply re-use the same QTimer object, instead of creating new ones?
All these timer are Qt internals. I'm not starting anthing, I'm just calling setVisible() on a few widgets
-
Looks like a known bug (FIXed only recently in Qt5.7) https://bugreports.qt.io/browse/QTBUG-45383