Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Looking for insight: processEvent() slowing down
QtWS25 Last Chance

Looking for insight: processEvent() slowing down

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • J JulienMaille

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @JulienMaille
      Are you able to see whether the process size (memory usage) is growing all the time together with the slow downs?

      J 1 Reply Last reply
      1
      • JonBJ JonB

        @JulienMaille
        Are you able to see whether the process size (memory usage) is growing all the time together with the slow downs?

        J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        @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);
        
        JonBJ 1 Reply Last reply
        0
        • J JulienMaille

          @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);
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @JulienMaille

          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....

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JulienMaille
            wrote on last edited by JulienMaille
            #5

            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 manually QCoreApplication::processEvents(QEventLoop::DeferredDeletion) in my OLE object will flush the eventLoop, however this sounds like a dirty workaround.

            JKSHJ 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Out of curiosity, how are you using these timers ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J JulienMaille

                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 manually QCoreApplication::processEvents(QEventLoop::DeferredDeletion) in my OLE object will flush the eventLoop, however this sounds like a dirty workaround.

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                @JulienMaille Could you simply re-use the same QTimer object, instead of creating new ones?

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                J 1 Reply Last reply
                0
                • JKSHJ JKSH

                  @JulienMaille Could you simply re-use the same QTimer object, instead of creating new ones?

                  J Offline
                  J Offline
                  JulienMaille
                  wrote on last edited by
                  #8

                  @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

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JulienMaille
                    wrote on last edited by
                    #9

                    Looks like a known bug (FIXed only recently in Qt5.7) https://bugreports.qt.io/browse/QTBUG-45383

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved